rendering all bytes

master
Allen Webster 2016-09-18 23:29:40 -04:00
parent 803f486973
commit 6d2589d149
2 changed files with 61 additions and 38 deletions

View File

@ -167,13 +167,13 @@
; [] API docs have duplicate ids? ; [] API docs have duplicate ids?
; [] introduce custom command line arguments ; [] introduce custom command line arguments
; [] control the file opening/start hook relationship better ; [] control the file opening/start hook relationship better
; [] flag for hiding the *messages* buffer.
; [] get keyboard state on launch ; [] get keyboard state on launch
; buffer behavior cleanup ; buffer behavior cleanup
; [] show all characters as \# if they can't be rendered ; [X] show all characters as \# if they can't be rendered
; [] binary buffer mode
; [] get the navigation working correctly around multi-glyph characters
; [] support full length unicode file names ; [] support full length unicode file names
; [] binary buffers
; meta programming system ; meta programming system
; [X] condense system into single meta compiler ; [X] condense system into single meta compiler

View File

@ -847,7 +847,7 @@ buffer_get_render_data(Buffer_Type *buffer, Buffer_Render_Item *items, int max,
float x, y; float x, y;
int i, item_i; int i, item_i;
float ch_width, ch_width_sub; float ch_width, ch_width_sub;
char ch; uint8_t ch;
size = buffer_size(buffer); size = buffer_size(buffer);
@ -875,7 +875,7 @@ buffer_get_render_data(Buffer_Type *buffer, Buffer_Render_Item *items, int max,
data = loop.data - loop.absolute_pos; data = loop.data - loop.absolute_pos;
for (i = loop.absolute_pos; i < end; ++i){ for (i = loop.absolute_pos; i < end; ++i){
ch = data[i]; ch = (uint8_t)data[i];
ch_width = measure_character(advance_data, ch); ch_width = measure_character(advance_data, ch);
if (ch_width + x > width + shift_x && wrapped && ch != '\n'){ if (ch_width + x > width + shift_x && wrapped && ch != '\n'){
@ -897,24 +897,6 @@ buffer_get_render_data(Buffer_Type *buffer, Buffer_Render_Item *items, int max,
} }
break; break;
case 0:
if (item < item_end){
ch_width = write_render_item_inline(item, i, '\\', x, y, advance_data, font_height);
item->flags = BRFlag_Special_Character;
++item_i;
++item;
x += ch_width;
if (item < item_end){
ch_width = write_render_item_inline(item, i, '0', x, y, advance_data, font_height);
item->flags = BRFlag_Special_Character;
++item_i;
++item;
x += ch_width;
}
}
break;
case '\r': case '\r':
if (item < item_end){ if (item < item_end){
ch_width = write_render_item_inline(item, i, '\\', x, y, advance_data, font_height); ch_width = write_render_item_inline(item, i, '\\', x, y, advance_data, font_height);
@ -961,19 +943,59 @@ buffer_get_render_data(Buffer_Type *buffer, Buffer_Render_Item *items, int max,
default: default:
if (item < item_end){ if (item < item_end){
if (ch >= ' ' && ch <= '~'){
write_render_item(item, i, ch, x, y, ch_width, font_height); write_render_item(item, i, ch, x, y, ch_width, font_height);
item->flags = 0; item->flags = 0;
++item_i; ++item_i;
++item; ++item;
x += ch_width; x += ch_width;
} }
else{
ch_width = write_render_item_inline(item, i, '\\', x, y, advance_data, font_height);
item->flags = BRFlag_Special_Character;
++item_i;
++item;
x += ch_width;
char C = '0' + (ch / 0x10);
if ((ch / 0x10) > 0x9){
C = ('A' - 0xA) + (ch / 0x10);
}
if (item < item_end){
ch_width = write_render_item_inline(item, i, C, x, y, advance_data, font_height);
item->flags = BRFlag_Special_Character;
++item_i;
++item;
x += ch_width;
}
ch = (ch % 0x10);
C = '0' + ch;
if (ch > 0x9){
C = ('A' - 0xA) + ch;
}
if (item < item_end){
ch_width = write_render_item_inline(item, i, C, x, y, advance_data, font_height);
item->flags = BRFlag_Special_Character;
++item_i;
++item;
x += ch_width;
}
}
}
break; break;
} }
if (y > height + shift_y) goto buffer_get_render_data_end;
if (y > height + shift_y){
goto buffer_get_render_data_end;
}
} }
} }
buffer_get_render_data_end: buffer_get_render_data_end:;
if (y <= height + shift_y || item == items){ if (y <= height + shift_y || item == items){
if (item < item_end){ if (item < item_end){
ch = 0; ch = 0;
@ -1004,5 +1026,6 @@ buffer_get_render_data(Buffer_Type *buffer, Buffer_Render_Item *items, int max,
#ifndef NON_ABSTRACT_4TECH #ifndef NON_ABSTRACT_4TECH
#define NON_ABSTRACT_4TECH 1 #define NON_ABSTRACT_4TECH 1
#endif #endif
// BOTTOM // BOTTOM