forked from bartvdbraak/blender
Bugfix #1676
Ancient bug: texteditor input was limited to "isprint()" characters, the default non-accented simple ascii set. I've removed that. Now we still have a conflict with hotkey handling, so ALT+character input won't work. But, for keyboards that have special character keys from itself, this patch will allow typing them in Text now.
This commit is contained in:
parent
4d1425f510
commit
bb802607eb
@ -32,7 +32,6 @@
|
|||||||
* ***** END GPL/BL DUAL LICENSE BLOCK *****
|
* ***** END GPL/BL DUAL LICENSE BLOCK *****
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ctype.h> /* isprint() */
|
|
||||||
#include <string.h> /* strstr */
|
#include <string.h> /* strstr */
|
||||||
|
|
||||||
#include "MEM_guardedalloc.h"
|
#include "MEM_guardedalloc.h"
|
||||||
@ -553,13 +552,6 @@ int txt_get_span (TextLine *from, TextLine *to)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int txt_illegal_char (char c)
|
|
||||||
{
|
|
||||||
if (isprint(c) || c=='\t') return 0;
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void txt_make_dirty (Text *text)
|
static void txt_make_dirty (Text *text)
|
||||||
{
|
{
|
||||||
text->flags |= TXT_ISDIRTY;
|
text->flags |= TXT_ISDIRTY;
|
||||||
@ -1285,7 +1277,8 @@ void txt_paste(Text *text)
|
|||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dump_buffer(Text *text) {
|
static void dump_buffer(Text *text)
|
||||||
|
{
|
||||||
int i= 0;
|
int i= 0;
|
||||||
|
|
||||||
while (i++<text->undo_pos) printf("%d: %d %c\n", i, text->undo_buf[i], text->undo_buf[i]);
|
while (i++<text->undo_pos) printf("%d: %d %c\n", i, text->undo_buf[i], text->undo_buf[i]);
|
||||||
@ -1954,7 +1947,8 @@ void txt_do_redo(Text *text)
|
|||||||
/* Line editing functions */
|
/* Line editing functions */
|
||||||
/**************************/
|
/**************************/
|
||||||
|
|
||||||
void txt_split_curline (Text *text) {
|
void txt_split_curline (Text *text)
|
||||||
|
{
|
||||||
TextLine *ins;
|
TextLine *ins;
|
||||||
char *left, *right, *fleft, *fright;
|
char *left, *right, *fleft, *fright;
|
||||||
|
|
||||||
@ -2072,7 +2066,8 @@ void txt_delete_char (Text *text)
|
|||||||
if(!undoing) txt_undo_add_charop(text, UNDO_DEL, c);
|
if(!undoing) txt_undo_add_charop(text, UNDO_DEL, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
void txt_backspace_char (Text *text) {
|
void txt_backspace_char (Text *text)
|
||||||
|
{
|
||||||
char c='\n';
|
char c='\n';
|
||||||
|
|
||||||
if (!text) return;
|
if (!text) return;
|
||||||
@ -2110,7 +2105,8 @@ void txt_backspace_char (Text *text) {
|
|||||||
if(!undoing) txt_undo_add_charop(text, UNDO_BS, c);
|
if(!undoing) txt_undo_add_charop(text, UNDO_BS, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
int txt_add_char (Text *text, char add) {
|
int txt_add_char (Text *text, char add)
|
||||||
|
{
|
||||||
int len;
|
int len;
|
||||||
char *tmp, *format;
|
char *tmp, *format;
|
||||||
|
|
||||||
@ -2122,8 +2118,6 @@ int txt_add_char (Text *text, char add) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(txt_illegal_char(add)) return 0;
|
|
||||||
|
|
||||||
txt_delete_sel(text);
|
txt_delete_sel(text);
|
||||||
|
|
||||||
tmp= MEM_mallocN(text->curl->len+2, "textline_string");
|
tmp= MEM_mallocN(text->curl->len+2, "textline_string");
|
||||||
|
@ -1417,8 +1417,10 @@ void winqreadtextspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
|
|||||||
int do_draw=0, p;
|
int do_draw=0, p;
|
||||||
|
|
||||||
/* smartass code to prevent the CTRL/ALT events below from not working! */
|
/* smartass code to prevent the CTRL/ALT events below from not working! */
|
||||||
if(!ispunct(ascii))
|
if(G.qual & (LR_ALTKEY|LR_CTRLKEY))
|
||||||
if (!isprint(ascii) || (G.qual & ~LR_SHIFTKEY)) ascii= 0;
|
if(!ispunct(ascii))
|
||||||
|
if(!isprint(ascii))
|
||||||
|
ascii= 0;
|
||||||
|
|
||||||
text= st->text;
|
text= st->text;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user