Skip to content

Commit 777e931

Browse files
committed
lexxer control
1 parent f150bca commit 777e931

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed

lua/swanky/edit/gui.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -608,6 +608,10 @@ local lay=
608608
{id="view_hex"},
609609
{id="view_txt"},
610610
{id="view_txt_wrap"},
611+
{id="view_lex_txt"},
612+
{id="view_lex_lua"},
613+
{id="view_lex_js"},
614+
{id="view_lex_glsl"},
611615
}},
612616

613617
-- {id="menu_font",text="Font",top_menu=true,menu_data=gui.menu_datas.font_size},

lua/wetgenes/gamecake/widgets/actions.csv

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ view_hex,,View as HEX,Display as hex dump.,
3636
view_txt,,View as TXT,Display as normal text.,
3737
view_txt_wrap,,View as TXT wrap,Display as line wrapped text.,
3838

39+
view_lex_txt,,Lex as txt,Lexically parse and highlight as txt.,
40+
view_lex_lua,,Lex as lua,Lexically parse and highlight as lua.,
41+
view_lex_js,,Lex as js,Lexically parse and highlight as js.,
42+
view_lex_glsl,,Lex as glsl,Lexically parse and highlight as glsl.,
43+
3944
theme_bright_tiny,,Bright Tiny,Set theme to Bright and Tiny,,"{theme=""bright"",grid_size=12,text_size=8}"
4045
theme_bright_small,,Bright Small,Set theme to Bright and Small,,"{theme=""bright"",grid_size=24,text_size=16}"
4146
theme_bright_medium,,Bright Medium,Set theme to Bright and Medium,,"{theme=""bright"",grid_size=36,text_size=24}"

lua/wetgenes/gamecake/widgets/texteditor.lua

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -777,6 +777,10 @@ function wtexteditor.mouse(pan,act,_x,_y,keyname)
777777
{id="view_hex"},
778778
{id="view_txt"},
779779
{id="view_txt_wrap"},
780+
{id="view_lex_txt"},
781+
{id="view_lex_lua"},
782+
{id="view_lex_js"},
783+
{id="view_lex_glsl"},
780784
}},
781785
{id="menu_search",menu_data={
782786
{id="search_find"},
@@ -985,6 +989,22 @@ function wtexteditor.msg(pan,m)
985989
texteditor.opts.word_wrap=true
986990
texteditor.texteditor_hooks("txt_changed")
987991

992+
elseif m.id=="view_lex_txt" then
993+
txt.set_lexer("txt")
994+
texteditor.texteditor_hooks("txt_changed")
995+
996+
elseif m.id=="view_lex_lua" then
997+
txt.set_lexer("lua")
998+
texteditor.texteditor_hooks("txt_changed")
999+
1000+
elseif m.id=="view_lex_js" then
1001+
txt.set_lexer("js")
1002+
texteditor.texteditor_hooks("txt_changed")
1003+
1004+
elseif m.id=="view_lex_glsl" then
1005+
txt.set_lexer("glsl")
1006+
texteditor.texteditor_hooks("txt_changed")
1007+
9881008
elseif m.id=="search_next" then -- or m.id=="search_find" then
9891009

9901010
local word=txt.copy() or ""

0 commit comments

Comments
 (0)