[Bf-committers] [Bf-blender-cvs] SVN commit: /data/svn/bf-blender [15127] branches/soc-2008-quorn/source/ blender: Whole word operations added:
J.P. Tuttle
jtuttle at gmail.com
Thu Jun 5 15:34:22 CEST 2008
Timothy P. Horton wrote:
> It's actually ALT + ArrowKey on Mac OS X, so they're not different from
> everyone else!
Well, Option + ArrowKey. The question is... what is it on Linux? (Are
we going for the default on each platform, or whatever is most common?)
-- J.P.
>
> On Jun 5, 2008, at 09:29, Chris Burt wrote:
>
>> Just a note: The standard for jumping a whole word Left/Right seems to
>> be CTRL + ArrowKey, not ALT + ArrowKey. So here is just one more thing
>> Blender does different than everyone else for no good reason.
>>
>> --Chris
>>
>> On Wed, Jun 4, 2008 at 7:20 PM, Ian Thompson <quornian at googlemail.com>
>> wrote:
>>> Revision: 15127
>>>
>>> http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=15127
>>>
>>> Author: quorn
>>> Date: 2008-06-05 01:20:54 +0200 (Thu, 05 Jun 2008)
>>>
>>> Log Message:
>>> -----------
>>> Whole word operations added:
>>> * Alt-Left/Right: moves cursor/selection a word to the left/right
>>> * Alt-/Ctrl-Delete/Backspace deletes whole words at a time
>>>
>>> Modified Paths:
>>> --------------
>>> branches/soc-2008-quorn/source/blender/blenkernel/BKE_text.h
>>> branches/soc-2008-quorn/source/blender/blenkernel/intern/text.c
>>> branches/soc-2008-quorn/source/blender/src/drawtext.c
>>>
>>> Modified: branches/soc-2008-quorn/source/blender/blenkernel/BKE_text.h
>>> ===================================================================
>>> ---
>>> branches/soc-2008-quorn/source/blender/blenkernel/BKE_text.h
>>> 2008-06-04 22:51:14 UTC (rev 15126)
>>> +++
>>> branches/soc-2008-quorn/source/blender/blenkernel/BKE_text.h
>>> 2008-06-04 23:20:54 UTC (rev 15127)
>>> @@ -59,6 +59,8 @@
>>> void txt_move_down (struct Text *text, short sel);
>>> void txt_move_left (struct Text *text, short sel);
>>> void txt_move_right (struct Text *text, short sel);
>>> +void txt_jump_left (struct Text *text, short sel);
>>> +void txt_jump_right (struct Text *text, short sel);
>>> void txt_move_bof (struct Text *text, short sel);
>>> void txt_move_eof (struct Text *text, short sel);
>>> void txt_move_bol (struct Text *text, short sel);
>>> @@ -66,6 +68,7 @@
>>> void txt_move_toline (struct Text *text, unsigned int line,
>>> short sel);
>>> void txt_pop_sel (struct Text *text);
>>> void txt_delete_char (struct Text *text);
>>> +void txt_delete_word (struct Text *text);
>>> void txt_copy_sel (struct Text *text);
>>> void txt_sel_all (struct Text *text);
>>> void txt_sel_line (struct Text *text);
>>> @@ -80,6 +83,7 @@
>>> void txt_do_redo (struct Text *text);
>>> void txt_split_curline (struct Text *text);
>>> void txt_backspace_char (struct Text *text);
>>> +void txt_backspace_word (struct Text *text);
>>> int txt_add_char (struct Text *text, char add);
>>> int txt_replace_char (struct Text *text, char add);
>>> void txt_find_panel (struct SpaceText *st, int again);
>>>
>>> Modified:
>>> branches/soc-2008-quorn/source/blender/blenkernel/intern/text.c
>>> ===================================================================
>>> ---
>>> branches/soc-2008-quorn/source/blender/blenkernel/intern/text.c
>>> 2008-06-04 22:51:14 UTC (rev 15126)
>>> +++
>>> branches/soc-2008-quorn/source/blender/blenkernel/intern/text.c
>>> 2008-06-04 23:20:54 UTC (rev 15127)
>>> @@ -117,6 +117,7 @@
>>> static void txt_undo_add_op(Text *text, int op);
>>> static void txt_undo_add_block(Text *text, int op, char *buf);
>>> static void txt_delete_line(Text *text, TextLine *line);
>>> +static int txt_word_boundary(char ch);
>>>
>>> /***/
>>>
>>> @@ -553,6 +554,17 @@
>>> if (text->compiled) BPY_free_compiled_text(text);
>>> }
>>>
>>> +static int txt_word_boundary (char ch)
>>> +{
>>> + if (ch < '0') return TRUE;
>>> + if (ch <= '9') return FALSE;
>>> + if (ch < 'A') return TRUE;
>>> + if (ch <= 'Z') return FALSE;
>>> + if (ch < 'a') return TRUE;
>>> + if (ch <= 'z') return FALSE;
>>> + return TRUE;
>>> +}
>>> +
>>> /****************************/
>>> /* Cursor utility functions */
>>> /****************************/
>>> @@ -689,6 +701,32 @@
>>> if(!sel) txt_pop_sel(text);
>>> }
>>>
>>> +void txt_jump_left(Text *text, short sel)
>>> +{
>>> + TextLine *l;
>>> + int c;
>>> + if (!text) return;
>>> + if (!text->curl) return;
>>> + do {
>>> + txt_move_left(text, sel);
>>> + l= sel ? text->sell : text->curl;
>>> + c= sel ? text->selc : text->curc;
>>> + } while (c>0 && c<l->len && !txt_word_boundary(l->line[c-1]));
>>> +}
>>> +
>>> +void txt_jump_right(Text *text, short sel)
>>> +{
>>> + TextLine *l;
>>> + int c;
>>> + if (!text) return;
>>> + if (!text->curl) return;
>>> + do {
>>> + txt_move_right(text, sel);
>>> + l= sel ? text->sell : text->curl;
>>> + c= sel ? text->selc : text->curc;
>>> + } while (c>0 && c<l->len && !txt_word_boundary(l->line[c-1]));
>>> +}
>>> +
>>> void txt_move_bol (Text *text, short sel)
>>> {
>>> TextLine **linep;
>>> @@ -2063,6 +2101,20 @@
>>> if(!undoing) txt_undo_add_charop(text, UNDO_DEL, c);
>>> }
>>>
>>> +void txt_delete_word (Text *text)
>>> +{
>>> + int i;
>>> + char ch;
>>> + if (!text) return;
>>> + if (!text->curl) return;
>>> + i= text->curc;
>>> + do {
>>> + ch= text->curl->line[i];
>>> + txt_delete_char(text);
>>> + i= text->curc;
>>> + } while (i<text->curl->len && !txt_word_boundary(ch));
>>> +}
>>> +
>>> void txt_backspace_char (Text *text)
>>> {
>>> char c='\n';
>>> @@ -2103,6 +2155,18 @@
>>> if(!undoing) txt_undo_add_charop(text, UNDO_BS, c);
>>> }
>>>
>>> +void txt_backspace_word (Text *text)
>>> +{
>>> + int i;
>>> + if (!text) return;
>>> + if (!text->curl) return;
>>> + i= text->curc;
>>> + do {
>>> + txt_backspace_char(text);
>>> + i= text->curc;
>>> + } while (i>0 && !txt_word_boundary(text->curl->line[i-1]));
>>> +}
>>> +
>>> int txt_add_char (Text *text, char add)
>>> {
>>> int len;
>>>
>>> Modified: branches/soc-2008-quorn/source/blender/src/drawtext.c
>>> ===================================================================
>>> --- branches/soc-2008-quorn/source/blender/src/drawtext.c
>>> 2008-06-04 22:51:14 UTC (rev 15126)
>>> +++ branches/soc-2008-quorn/source/blender/src/drawtext.c
>>> 2008-06-04 23:20:54 UTC (rev 15127)
>>> @@ -1892,14 +1892,22 @@
>>> pop_space_text(st);
>>> break;
>>> case BACKSPACEKEY:
>>> - txt_backspace_char(text);
>>> + if (G.qual & (LR_ALTKEY | LR_CTRLKEY)) {
>>> + txt_backspace_word(text);
>>> + } else {
>>> + txt_backspace_char(text);
>>> + }
>>> set_tabs(text);
>>> if (st->showsyntax) get_format_string(st);
>>> do_draw= 1;
>>> pop_space_text(st);
>>> break;
>>> case DELKEY:
>>> - txt_delete_char(text);
>>> + if (G.qual & (LR_ALTKEY | LR_CTRLKEY)) {
>>> + txt_delete_word(text);
>>> + } else {
>>> + txt_delete_char(text);
>>> + }
>>> if (st->showsyntax) get_format_string(st);
>>> do_draw= 1;
>>> pop_space_text(st);
>>> @@ -1918,6 +1926,8 @@
>>> case LEFTARROWKEY:
>>> if (G.qual & LR_COMMANDKEY)
>>> txt_move_bol(text, G.qual & LR_SHIFTKEY);
>>> + else if (G.qual & LR_ALTKEY)
>>> + txt_jump_left(text, G.qual &
>>> LR_SHIFTKEY);
>>> else
>>> txt_move_left(text, G.qual & LR_SHIFTKEY);
>>> set_tabs(text);
>>> @@ -1927,6 +1937,8 @@
>>> case RIGHTARROWKEY:
>>> if (G.qual & LR_COMMANDKEY)
>>> txt_move_eol(text, G.qual & LR_SHIFTKEY);
>>> + else if (G.qual & LR_ALTKEY)
>>> + txt_jump_right(text, G.qual &
>>> LR_SHIFTKEY);
>>> else
>>> txt_move_right(text, G.qual &
>>> LR_SHIFTKEY);
>>> set_tabs(text);
>>>
>>>
>>> _______________________________________________
>>> Bf-blender-cvs mailing list
>>> Bf-blender-cvs at blender.org
>>> http://lists.blender.org/mailman/listinfo/bf-blender-cvs
>>>
>> _______________________________________________
>> Bf-committers mailing list
>> Bf-committers at blender.org
>> http://lists.blender.org/mailman/listinfo/bf-committers
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at blender.org
> http://lists.blender.org/mailman/listinfo/bf-committers
More information about the Bf-committers
mailing list