all repos — fluxbox @ 4ddda95f20280da40b0f9412d340119141f70d46

custom fork of the fluxbox windowmanager

patch from vadim to fix the issues in input-areas he introduced with his last
patch
mathias mathias
commit

4ddda95f20280da40b0f9412d340119141f70d46

parent

5763339f4c732e53e786c798fb4143d7af4b291f

2 files changed, 39 insertions(+), 25 deletions(-)

jump to
M ChangeLogChangeLog

@@ -1,6 +1,8 @@

(Format: Year/Month/Day) Changes for 0.9.13 *05/05/07: + * Fix isses in patch from Vadim (thanx Vadim) + FbTk/TextBox.cc * Remove default "gray" background (Simon) FbTk/FbWindow.cc * Fix titlebar transparency in some (tabbed) cases (Simon)

@@ -11,7 +13,7 @@ - Shade - just like the "Stick"-button

Styleresources: window.shade.pixmap, window.shade.unfocus.pixmap, window.shade.pressed.pixmap window.unshade.pixmap, window.unshade.unfocus.pixmap, window.unshade.pressed.pixmap - etc. + etc. - MenuIcon - click on it provides the windowmenu, if the app contains a pixmap (gvim, konqueror etc etc) the pixmap is displayed, a little menu otherwise.

@@ -26,7 +28,7 @@ * xrestop should now display "Fluxbox" (Simon)

Ewmh.hh/cc * Fix potential segfault menu bug, thanks chenfeng (Simon) Menu.cc - * Added more KeyActions to TextBox (thanx to Vadim <suhanov_vadim@mail.ru> + * Added more KeyActions to TextBox (thanx to Vadim <suhanov_vadim at mail dot ru> Control + LeftArrow -> Moves cursor to the left direction, up to next word. Control + RightArrow -> to the right direction. Control + BackSpace -> Removes everything from the cursor left side, up to next left word.
M src/FbTk/TextBox.ccsrc/FbTk/TextBox.cc

@@ -246,44 +246,54 @@ m_start_pos = 0;

m_cursor_pos = 0; m_end_pos = 0; break; - case XK_Left: - if (m_cursor_pos && m_text.size()){ - m_cursor_pos = findEmptySpaceLeft(); + case XK_Left: { + int pos = findEmptySpaceLeft(); + if (pos < m_start_pos){ + m_start_pos = pos; + m_cursor_pos = 0; + } else if (m_start_pos > 0) { + m_cursor_pos = pos - m_start_pos; + } else { + m_cursor_pos = pos; + } adjustPos(); } break; case XK_Right: if (m_text.size() && m_cursor_pos < m_text.size()){ - m_cursor_pos = findEmptySpaceRight(); + int pos = findEmptySpaceRight() - m_start_pos; + if (m_start_pos + pos <= m_end_pos) + m_cursor_pos = pos; + else if (m_end_pos < text().size()) { + m_cursor_pos = pos; + m_end_pos = pos; + } + adjustPos(); + } break; case XK_BackSpace: { - if (!m_cursor_pos || !m_text.size()) - break; - int pos = findEmptySpaceLeft(); + m_text.erase(pos, m_cursor_pos - pos + m_start_pos); - m_text.erase(pos, m_cursor_pos - pos); - m_start_pos = 0; - m_cursor_pos = pos; - m_end_pos = m_text.size(); + if (pos < m_start_pos){ + m_start_pos = pos; + m_cursor_pos = 0; + } else if (m_start_pos > 0) { + m_cursor_pos = pos - m_start_pos; + } else { + m_cursor_pos = pos; + } adjustPos(); } break; case XK_Delete: { - if (!m_text.size() || m_cursor_pos >= m_text.size()) break; - int pos = findEmptySpaceRight(); - - m_text.erase(m_cursor_pos, pos - m_cursor_pos); - m_start_pos = 0; - m_cursor_pos = m_cursor_pos; - m_end_pos = m_text.size(); - + m_text.erase(m_cursor_pos + m_start_pos, pos - (m_cursor_pos + m_start_pos)); adjustPos(); } break;

@@ -399,11 +409,12 @@

int TextBox::findEmptySpaceLeft(){ // found the first left space symbol - int pos = m_text.rfind(' ', m_cursor_pos - 1); + int pos = m_text.rfind(' ', (m_start_pos + m_cursor_pos) > 0 ? + m_start_pos + m_cursor_pos - 1 : 0); // do we have one more space symbol near? int next_pos = -1; - while ( pos > 0 && (next_pos = m_text.rfind(' ', pos - 1)) > -1 ){ + while (pos > 0 && (next_pos = m_text.rfind(' ', pos - 1)) > -1){ if (next_pos + 1 < pos) break; pos = next_pos;

@@ -417,17 +428,18 @@ }

int TextBox::findEmptySpaceRight(){ // found the first right space symbol - int pos = m_text.find(' ', m_cursor_pos); + int pos = m_text.find(' ', m_start_pos + m_cursor_pos); // do we have one more space symbol near? int next_pos = -1; while (pos > -1 && pos < m_text.size() && (next_pos = m_text.find(' ', pos + 1)) > -1 ){ + if (next_pos - 1 > pos) break; pos = next_pos; } if (pos < 0) - pos = m_text.size(); + pos = m_text.size() - 1; return pos + 1; // (+1) - sets cursor at the right.