diff options
author | Joshua Leung <aligorith@gmail.com> | 2010-02-09 14:18:17 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2010-02-09 14:18:17 +0300 |
commit | 0e7c973e06c9e3cb42a68350a60d96c3d3a82e6d (patch) | |
tree | 86b92fa4f867fa42f96dab9a67ee76a663d5d2f7 /source/blender/blenkernel/intern | |
parent | 945a126170137073b4930e53c016a674601232d6 (diff) |
Bugfix #21041: pressing tab, adds spaces depending on the end of the line
The code used to calculate the number of spaces to insert for a tab (so that indention widths were aligned to multiples of the number of spaces to use) was incorrectly assuming that the line that this was to occur on was blank, using text->curl->len (i.e. the length of the current line).
The code now uses the position of the cursor to determine how many spaces need to be added to it to move it to the next multiple of the tab width.
---
Also, added numpad enter to text-editor keymap for creating new lines for more consistency with user expectations.
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/text.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index 1eea035ec2c..ebe2d21826f 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -2370,7 +2370,11 @@ static char tab_to_spaces[] = " "; static void txt_convert_tab_to_spaces (Text *text) { - char *sb = &tab_to_spaces[text->curl->len % TXT_TABSIZE]; + /* sb aims to pad adjust the tab-width needed so that the right number of spaces + * is added so that the indention of the line is the right width (i.e. aligned + * to multiples of TXT_TABSIZE) + */ + char *sb = &tab_to_spaces[text->curc % TXT_TABSIZE]; txt_insert_buf(text, sb); } |