From b8bc24764ebec8a19e0a61f0e1f2b2843be22d70 Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Tue, 28 Mar 2006 23:27:20 +0000 Subject: STR 1183: swapping two items in an Fl_Browser_ widget would corrupt redrawing if either item was "top". This fix swaps the top_ variable correctly, and also swaps the selection flag as the user would expect. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@4879 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Fl_Browser_.cxx | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/Fl_Browser_.cxx') diff --git a/src/Fl_Browser_.cxx b/src/Fl_Browser_.cxx index 8f51318fe..8637e9cba 100644 --- a/src/Fl_Browser_.cxx +++ b/src/Fl_Browser_.cxx @@ -470,6 +470,15 @@ void Fl_Browser_::replacing(void* a, void* b) { if (a == max_width_item) {max_width_item = 0; max_width = 0;} } +void Fl_Browser_::swapping(void* a, void* b) { + redraw_line(a); + redraw_line(b); + if (a == selection_) selection_ = b; + else if (b == selection_) selection_ = a; + if (a == top_) top_ = b; + else if (b == top_) top_ = a; +} + void Fl_Browser_::inserting(void* a, void* b) { if (displayed(a)) redraw_lines(); if (a == top_) top_ = b; -- cgit v1.2.3