Mercurial Hosting > editor
comparison editor.luan @ 22:b2d9b3836c2b
work
| author | Franklin Schmidt <fschmidt@gmail.com> | 
|---|---|
| date | Tue, 08 Apr 2025 23:03:22 -0600 | 
| parents | 79f060db4d79 | 
| children | e4af9e024d63 | 
   comparison
  equal
  deleted
  inserted
  replaced
| 21:79f060db4d79 | 22:b2d9b3836c2b | 
|---|---|
| 191 | 191 | 
| 192 local function make_find_dialog(window) | 192 local function make_find_dialog(window) | 
| 193 local dialog = new_dialog(window.frame) | 193 local dialog = new_dialog(window.frame) | 
| 194 local root = dialog.component | 194 local root = dialog.component | 
| 195 root.set_layout(new_box_layout(root,"y_axis")) | 195 root.set_layout(new_box_layout(root,"y_axis")) | 
| 196 do | 196 root.add_all{ | 
| 197 local buttons = new_panel() | 197 new_panel{ | 
| 198 buttons.set_layout(new_flow_layout("left")) | 198 layout = new_flow_layout("left") | 
| 199 --buttons.border = create_empty_border(8,8,8,8) | 199 --border = create_empty_border(8,8,8,8) | 
| 200 buttons.border = create_line_border(int_to_color(0)) | 200 border = create_line_border(int_to_color(0)) | 
| 201 | 201 children = { | 
| 202 local find_next = new_button() | 202 new_button{ | 
| 203 find_next.text = "Find Next" | 203 text = "Find Next" | 
| 204 buttons.add(find_next) | 204 } | 
| 205 | 205 new_button{ | 
| 206 local find_prev = new_button() | 206 text = "Find Previous" | 
| 207 find_prev.text = "Find Previous" | 207 } | 
| 208 buttons.add(find_prev) | 208 } | 
| 209 | 209 } | 
| 210 root.add(buttons) | 210 } | 
| 211 end | |
| 212 dialog.pack() | 211 dialog.pack() | 
| 213 local was_shown = false | 212 local was_shown = false | 
| 214 function window.show_find_dialog() | 213 function window.show_find_dialog() | 
| 215 if not was_shown then | 214 if not was_shown then | 
| 216 was_shown = true | 215 was_shown = true | 
| 233 n_windows = n_windows - 1 | 232 n_windows = n_windows - 1 | 
| 234 if n_windows == 0 then | 233 if n_windows == 0 then | 
| 235 Luan.exit() | 234 Luan.exit() | 
| 236 end | 235 end | 
| 237 end) | 236 end) | 
| 238 local text_area = new_text_area() | 237 local text_area = new_text_area{} | 
| 239 window.text_area = text_area | 238 window.text_area = text_area | 
| 240 if file ~= nil then | 239 if file ~= nil then | 
| 241 local document = documents[title] | 240 local document = documents[title] | 
| 242 if document == nil then | 241 if document == nil then | 
| 243 documents[title] = text_area.document | 242 documents[title] = text_area.document | 
| 265 text_area.line_wrap = true | 264 text_area.line_wrap = true | 
| 266 text_area.tab_size = 4 | 265 text_area.tab_size = 4 | 
| 267 text_area.set_font{ family="Monospaced", size=13 } | 266 text_area.set_font{ family="Monospaced", size=13 } | 
| 268 text_area.set_selection(0) | 267 text_area.set_selection(0) | 
| 269 --print(text_area.line_count) | 268 --print(text_area.line_count) | 
| 270 local scroll_pane = new_scroll_pane(text_area) | 269 local scroll_pane = new_scroll_pane{ | 
| 271 local line_numbers = new_text_area_line_numbers(text_area) | 270 view = text_area | 
| 271 } | |
| 272 local line_numbers = new_text_area_line_numbers{ | |
| 273 text_area = text_area | |
| 274 } | |
| 272 line_numbers.foreground_color = int_to_color(0x888888) | 275 line_numbers.foreground_color = int_to_color(0x888888) | 
| 273 line_numbers.border = create_empty_border(0,8,0,8) | 276 line_numbers.border = create_empty_border(0,8,0,8) | 
| 274 scroll_pane.set_row_header_view(line_numbers) | 277 scroll_pane.set_row_header_view(line_numbers) | 
| 275 frame.add(scroll_pane) | 278 frame.add(scroll_pane) | 
| 276 function window.open() | 279 function window.open() | 
