|
@@ -3,7 +3,9 @@
|
|
|
Copyright (C) 1996, 1997, 1998, 2001, 2002, 2003, 2004, 2005, 2006,
|
|
|
2007 Free Software Foundation, Inc.
|
|
|
|
|
|
- Authors: 1996, 1997 Paul Sheer
|
|
|
+ Authors:
|
|
|
+ Paul Sheer 1996, 1997
|
|
|
+ Ilia Maslakov <il.smind@gmail.com> 2009, 2010, 2011
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
it under the terms of the GNU General Public License as published by
|
|
@@ -57,7 +59,7 @@
|
|
|
#endif
|
|
|
|
|
|
#include "src/filemanager/cmd.h" /* view_other_cmd() */
|
|
|
-#include "src/filemanager/usermenu.h" /* user_menu_cmd() */
|
|
|
+#include "src/filemanager/usermenu.h" /* user_menu_cmd() */
|
|
|
|
|
|
#include "src/main.h" /* source_codepage */
|
|
|
#include "src/setup.h" /* option_tab_spacing */
|
|
@@ -3127,6 +3129,56 @@ edit_mark_cmd (WEdit * edit, int unmark)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+/* --------------------------------------------------------------------------------------------- */
|
|
|
+/** highlight the word under cursor */
|
|
|
+
|
|
|
+void
|
|
|
+edit_mark_current_word_cmd (WEdit * edit)
|
|
|
+{
|
|
|
+ long pos;
|
|
|
+
|
|
|
+ for (pos = edit->curs1; pos != 0; pos--)
|
|
|
+ {
|
|
|
+ int c1, c2;
|
|
|
+
|
|
|
+ c1 = edit_get_byte (edit, pos);
|
|
|
+ c2 = edit_get_byte (edit, pos - 1);
|
|
|
+ if (!isspace (c1) && isspace (c2))
|
|
|
+ break;
|
|
|
+ if ((my_type_of (c1) & my_type_of (c2)) == 0)
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ edit->mark1 = pos;
|
|
|
+
|
|
|
+ for (; pos < edit->last_byte; pos++)
|
|
|
+ {
|
|
|
+ int c1, c2;
|
|
|
+
|
|
|
+ c1 = edit_get_byte (edit, pos);
|
|
|
+ c2 = edit_get_byte (edit, pos + 1);
|
|
|
+ if (!isspace (c1) && isspace (c2))
|
|
|
+ break;
|
|
|
+ if ((my_type_of (c1) & my_type_of (c2)) == 0)
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ edit->mark2 = min (pos + 1, edit->last_byte);
|
|
|
+
|
|
|
+ edit->force |= REDRAW_LINE_ABOVE | REDRAW_AFTER_CURSOR;
|
|
|
+}
|
|
|
+
|
|
|
+/* --------------------------------------------------------------------------------------------- */
|
|
|
+
|
|
|
+void
|
|
|
+edit_mark_current_line_cmd (WEdit * edit)
|
|
|
+{
|
|
|
+ long pos = edit->curs1;
|
|
|
+
|
|
|
+ edit->mark1 = edit_bol (edit, pos);
|
|
|
+ edit->mark2 = edit_eol (edit, pos);
|
|
|
+
|
|
|
+ edit->force |= REDRAW_LINE_ABOVE | REDRAW_AFTER_CURSOR;
|
|
|
+}
|
|
|
+
|
|
|
/* --------------------------------------------------------------------------------------------- */
|
|
|
|
|
|
void
|
|
@@ -3686,7 +3738,18 @@ edit_execute_cmd (WEdit * edit, unsigned long command, int char_for_insertion)
|
|
|
edit->column_highlight = 0;
|
|
|
edit_mark_cmd (edit, 1);
|
|
|
break;
|
|
|
-
|
|
|
+ case CK_Mark_Word:
|
|
|
+ if (edit->column_highlight)
|
|
|
+ edit_push_action (edit, COLUMN_ON);
|
|
|
+ edit->column_highlight = 0;
|
|
|
+ edit_mark_current_word_cmd (edit);
|
|
|
+ break;
|
|
|
+ case CK_Mark_Line:
|
|
|
+ if (edit->column_highlight)
|
|
|
+ edit_push_action (edit, COLUMN_ON);
|
|
|
+ edit->column_highlight = 0;
|
|
|
+ edit_mark_current_line_cmd (edit);
|
|
|
+ break;
|
|
|
case CK_Toggle_Line_State:
|
|
|
option_line_state = !option_line_state;
|
|
|
if (option_line_state)
|