From 5862306295a98440c4e4272d9c07b71ab5c08969 Mon Sep 17 00:00:00 2001 From: Dick Hollenbeck Date: Tue, 22 Oct 2013 09:29:48 -0500 Subject: [PATCH] When pasting into a fp_lib_table with no initial rows, start at column zero, not -1. --- pcbnew/dialogs/dialog_fp_lib_table.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/pcbnew/dialogs/dialog_fp_lib_table.cpp b/pcbnew/dialogs/dialog_fp_lib_table.cpp index bf7b9d3ac1..6e28cdea04 100644 --- a/pcbnew/dialogs/dialog_fp_lib_table.cpp +++ b/pcbnew/dialogs/dialog_fp_lib_table.cpp @@ -251,16 +251,16 @@ class DIALOG_FP_LIB_TABLE : public DIALOG_FP_LIB_TABLE_BASE int selRowCount; int selColCount; - int getCursorRow() const - { - return m_cur_grid->GetGridCursorRow(); - } - int getCursorCol() const { return m_cur_grid->GetGridCursorCol(); } + int getCursorRow() const + { + return m_cur_grid->GetGridCursorRow(); + } + /// Gets the selected area into a sensible rectangle of sel{Row,Col}{Start,Count} above. void getSelectedArea() { @@ -893,8 +893,9 @@ void DIALOG_FP_LIB_TABLE::paste() } else { - const int cur_row = getCursorRow(); - const int cur_col = getCursorCol(); + const int cur_row = getCursorRow(); // -1 is ok + const int cur_col = std::max( getCursorCol(), 0 ); // no -1 + wxStringTokenizer rows( cb_text, ROW_SEP, wxTOKEN_RET_EMPTY ); // if clipboard rows would extend past end of current table size...