Mercurial > octave
comparison libgui/src/m-editor/find-dialog.cc @ 19912:b8ce2f42815c
gui: when search backward, start from beginning of previous text (Bug #44439)
* libgui/src/m-editor/find-dialog.cc
(find_dialog::find): when search backward, start from beginning of previous text.
author | John D |
---|---|
date | Fri, 06 Mar 2015 11:34:21 -0500 |
parents | 4197fc428c7d |
children | aa36fb998a4d |
comparison
equal
deleted
inserted
replaced
19911:2b5cbea8f442 | 19912:b8ce2f42815c |
---|---|
288 col = 0; | 288 col = 0; |
289 } | 289 } |
290 } | 290 } |
291 else if (! do_forward) | 291 else if (! do_forward) |
292 { | 292 { |
293 // search from previous character if search backward | 293 // search from position before search characters text length |
294 // if search backward on existing results, | |
294 _edit_area->getCursorPosition (&line,&col); | 295 _edit_area->getCursorPosition (&line,&col); |
295 int currpos = _edit_area->positionFromLineIndex(line,col); | 296 if (_find_result_available && _edit_area->hasSelectedText ()) |
296 if (currpos > 0) currpos --; | 297 { |
297 _edit_area->lineIndexFromPosition(currpos, &line,&col); | 298 int currpos = _edit_area->positionFromLineIndex(line,col); |
299 currpos -= (_search_line_edit->text ().length ()); | |
300 if (currpos < 0) | |
301 currpos = 0; | |
302 _edit_area->lineIndexFromPosition(currpos, &line,&col); | |
303 } | |
298 } | 304 } |
299 } | 305 } |
300 | 306 |
301 if (_edit_area) | 307 if (_edit_area) |
302 { | 308 { |