bugfix: consistently map definitions to names
I created this bug when I implemented GET*, but it was already latent before that, when I lazily used get_cmd_from_buffer to get the definition name from buffer instead of creating two different names with identical definitions.
This commit is contained in:
parent
dd7a09f1e1
commit
59f16848b2
|
@ -4,14 +4,14 @@ on.text_input = function(t)
|
|||
text_input_on_manifest_navigator(t)
|
||||
elseif Cursor_node then
|
||||
local old_top = {line=Cursor_node.editor.screen_top1.line, pos=Cursor_node.editor.screen_top1.pos}
|
||||
local old_definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
|
||||
local old_definition_name = live.get_definition_name_from_buffer(Cursor_node.editor.lines[1].data)
|
||||
edit.text_input(Cursor_node.editor, t)
|
||||
if not eq(Cursor_node.editor.screen_top1, old_top) then
|
||||
Viewport.y = Cursor_node.y + y_of_schema1(Cursor_node.editor, Cursor_node.editor.screen_top1)
|
||||
end
|
||||
local definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
|
||||
local definition_name = live.get_definition_name_from_buffer(Cursor_node.editor.lines[1].data)
|
||||
maybe_update_key_in_definitions(old_definition_name, definition_name, Cursor_node)
|
||||
Cursor_node.bg = definition_background_color(definition_name)
|
||||
B(--[[preserve screen_top of cursor node]] true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -46,12 +46,12 @@ on.keychord_press = function(chord, key)
|
|||
submit_definition(Cursor_node.editor)
|
||||
else
|
||||
local old_top = {line=Cursor_node.editor.screen_top1.line, pos=Cursor_node.editor.screen_top1.pos}
|
||||
local old_definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
|
||||
local old_definition_name = live.get_definition_name_from_buffer(Cursor_node.editor.lines[1].data)
|
||||
edit.keychord_press(Cursor_node.editor, chord, key)
|
||||
if not eq(Cursor_node.editor.screen_top1, old_top) then
|
||||
Viewport.y = Cursor_node.y + y_of_schema1(Cursor_node.editor, Cursor_node.editor.screen_top1)
|
||||
end
|
||||
local definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
|
||||
local definition_name = live.get_definition_name_from_buffer(Cursor_node.editor.lines[1].data)
|
||||
maybe_update_key_in_definitions(old_definition_name, definition_name, Cursor_node)
|
||||
if chord == 'return' then
|
||||
A(--[[preserve screen_top of cursor node]] true)
|
||||
|
|
|
@ -6,7 +6,7 @@ get_multiple_definitions_from_app = function(defs)
|
|||
local response = wait_for_response()
|
||||
local result = {}
|
||||
for def in response:gmatch('(.-)\n==fw: definition boundary==\n') do
|
||||
local name = live.get_cmd_from_buffer(def)
|
||||
local name = live.get_definition_name_from_buffer(def)
|
||||
if name == nil then
|
||||
print('failed to get cmd from buffer', def)
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue