aboutsummaryrefslogtreecommitdiffstats
path: root/vim-mode/vim_mode.pl
diff options
context:
space:
mode:
authorTom Feist <shabble@metavore.org>2010-09-29 01:53:22 +0000
committerTom Feist <shabble@metavore.org>2010-09-29 01:53:22 +0000
commit275ce1fd35a3ffffcbf49c24f4e28cd744c5ec9b (patch)
tree73efd0563407ae9443fcd6a5c5a74218c92d91fb /vim-mode/vim_mode.pl
parentMerge remote branch 'origin/dev' (diff)
downloadirssi-scripts-275ce1fd35a3ffffcbf49c24f4e28cd744c5ec9b.tar.gz
irssi-scripts-275ce1fd35a3ffffcbf49c24f4e28cd744c5ec9b.zip
additional debug prints in _input(_pos) to determine why undo positions are
being set incorrectly
Diffstat (limited to 'vim-mode/vim_mode.pl')
-rw-r--r--vim-mode/vim_mode.pl25
1 files changed, 20 insertions, 5 deletions
diff --git a/vim-mode/vim_mode.pl b/vim-mode/vim_mode.pl
index bd4d39f..8dfa35d 100644
--- a/vim-mode/vim_mode.pl
+++ b/vim-mode/vim_mode.pl
@@ -1245,9 +1245,15 @@ sub UNLOAD {
sub _add_undo_entry {
my ($line, $pos) = @_;
- # add to the front of the buffer
- print "adding $line to undo list" if DEBUG;
- unshift @undo_buffer, [$line, $pos];
+ # check it's not a dupe of the list head
+ my $head = $undo_buffer[0];
+ if ($line eq $head->[0] && $pos == $head->[1]) {
+ print "Not adding duplicate to undo list";
+ } else {
+ print "adding $line to undo list" if DEBUG;
+ # add to the front of the buffer
+ unshift @undo_buffer, [$line, $pos];
+ }
$undo_index = 0;
}
@@ -1268,7 +1274,11 @@ sub _print_undo_buffer {
} else {
$str .= ' ';
}
- $str .= sprintf('%02d %s [%d]', $i, $entry->[0], $entry->[1]);
+ my ($line, $pos) = @$entry;
+ substr($line, $pos, 0) = '*';
+ # substr($line, $pos+3, 0) = '%_';
+
+ $str .= sprintf('%02d %s [%d]', $i, $line, $pos);
push @buf, $str;
$i++;
}
@@ -1306,9 +1316,12 @@ sub _input {
if (defined $data) {
if (!$ignore_undo && ($data ne $current_data)) {
if ($undo_index != 0) { # ???
+ print "Resetting undo buffer" if DEBUG;
_reset_undo_buffer($current_data, _input_pos());
} else {
- _add_undo_entry($current_data, _input_pos());
+ my $pos = _input_pos();
+ print "Adding debug entry: $current_data $pos" if DEBUG;
+ _add_undo_entry($current_data, $pos);
}
}
if ($utf8) {
@@ -1332,9 +1345,11 @@ sub _input_pos {
my $cur_pos = Irssi::gui_input_get_pos();
if (defined $pos) {
+ print "Input pos being set from $cur_pos to $pos" if DEBUG;
Irssi::gui_input_set_pos($pos) if $pos != $cur_pos;
} else {
$pos = $cur_pos;
+ print "Input pos retrieved as $pos" if DEBUG;
}
return $pos;