projects
/
selector.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
cf198ad
)
Removed a bug when inserting a char in the middle of the pattern.
author
Francois Fleuret
<francois@fleuret.org>
Mon, 6 Apr 2009 19:31:43 +0000
(21:31 +0200)
committer
Francois Fleuret
<francois@fleuret.org>
Mon, 6 Apr 2009 19:31:43 +0000
(21:31 +0200)
selector.cc
patch
|
blob
|
history
diff --git
a/selector.cc
b/selector.cc
index
b84bd79
..
c936029
100644
(file)
--- a/
selector.cc
+++ b/
selector.cc
@@
-755,18
+755,15
@@
int main(int argc, char **argv) {
if(key >= ' ' && key <= '~') { // Insert character
int c = cursor_position;
char t = pattern[c], u;
if(key >= ' ' && key <= '~') { // Insert character
int c = cursor_position;
char t = pattern[c], u;
- if(t) {
- while(t) {
- c++;
- u = pattern[c];
- pattern[c] = t;
- t = u;
- }
- pattern[cursor_position++] = key;
- } else {
- pattern[cursor_position++] = key;
- pattern[cursor_position] = '\0';
+ while(t) {
+ c++;
+ u = pattern[c];
+ pattern[c] = t;
+ t = u;
}
}
+ c++;
+ pattern[c] = '\0';
+ pattern[cursor_position++] = key;
}
else if(key == KEY_BACKSPACE || key == '
\b
' || key == '
\7f
') {
}
else if(key == KEY_BACKSPACE || key == '
\b
' || key == '
\7f
') {