about summary refs log tree commit diff stats
path: root/source_text.lua
Commit message (Expand)AuthorAgeFilesLines
* use deepcopy where possibleKartik K. Agaram2024-06-231-14/+14
* crap, fix some final changes in the source editorKartik K. Agaram2024-06-111-7/+5
* stop caching startyKartik K. Agaram2024-06-111-6/+29
* stop caching screen_bottom1Kartik K. Agaram2024-06-111-44/+79
* bugfix in source editorKartik K. Agaram2024-06-091-0/+19
* bugfix in cursor positioningKartik K. Agaram2024-02-081-1/+1
* use editor state font for width calculationsKartik K. Agaram2024-01-121-29/+29
* bugfix: utf-8Kartik K. Agaram2023-12-261-1/+2
* make button backgrounds optionalKartik K. Agaram2023-12-181-1/+1
* fix a couple of asserts missed in the recent auditKartik K. Agaram2023-12-091-2/+1
* port keyboard layout handling to source editorKartik K. Agaram2023-11-251-1/+8
* bugfix: infinite loop inside a very narrow windowKartik K. Agaram2023-11-241-1/+3
* establish a fairly fundamental invariantKartik K. Agaram2023-11-241-0/+6
* audit all assertsKartik K. Agaram2023-11-181-23/+22
* clearer API for drawing a buttonKartik K. Agaram2023-10-161-1/+1
* hide line numbers from log browserKartik K. Agaram2023-09-151-3/+5
* always show line numbers in source editorKartik K. Agaram2023-09-141-0/+2
* reorganize some commentsKartik K. Agaram2023-07-311-2/+2
* bugfix: search highlight straddling screen linesKartik K. Agaram2023-07-311-7/+8
* remove a duplicate print to screenKartik K. Agaram2023-07-311-11/+9
* extract a variableKartik K. Agaram2023-07-311-1/+2
* bugfix: highlight search patterns on the right lineKartik K. Agaram2023-07-311-2/+7
* hoist and duplicate a conditionalKartik K. Agaram2023-07-311-3/+5
* improve a commentKartik K. Agaram2023-07-311-1/+1
* port inscript's bugfix to source editorKartik K. Agaram2023-06-041-0/+15
* add an assertKartik K. Agaram2023-05-141-0/+1
* bugfix: rendering hyperlinks in wrapping linesKartik K. Agaram2023-05-141-1/+1
* bugfix: never use utf8 pos in string.subKartik K. Agaram2023-05-061-1/+3
* remove some support for long lines from source editorKartik K. Agaram2023-04-191-13/+4
* rename a variableKartik K. Agaram2023-04-081-6/+6
* bugfix: syntax highlighting in source editorKartik K. Agaram2023-04-081-2/+7
* switch source side to new screen-line-based renderKartik K. Agaram2023-04-031-94/+111
* start thinking of compute_fragments as a detailKartik K. Agaram2023-04-011-1/+1
* stop creating a singleton table for every wordKartik K. Agaram2023-04-011-12/+12
* clean up some debug printsKartik K. Agaram2023-04-011-8/+0
* no more Text allocationsKartik K. Agaram2023-04-011-16/+10
* App.width can no longer take a TextKartik K. Agaram2023-04-011-11/+8
* get rid of to_textKartik K. Agaram2023-04-011-2/+1
* update stale source X-(Kartik K. Agaram2023-03-261-0/+1
* more bugfixKartik K. Agaram2023-03-171-1/+1
* bugfixKartik K. Agaram2023-03-171-9/+14
* get rid of all bifold textKartik K. Agaram2023-03-171-784/+92
* bring a few things in sync between run and sourceKartik K. Agaram2023-03-171-4/+20
* bugfix: up arrow when line above is a drawingKartik K. Agaram2023-01-311-2/+2
* make love event names consistentKartik K. Agaram2022-12-231-3/+3
* hide editor cursor while in file navigatorKartik K. Agaram2022-09-181-3/+3
* support selections in the source editorKartik K. Agaram2022-09-061-1/+60
* support hyperlinks in the source editorKartik K. Agaram2022-09-051-0/+33
* support drawings in the source editorKartik K. Agaram2022-09-051-60/+137
* editing source code from within the appKartik K. Agaram2022-09-031-0/+1561
c */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
-- Simple immediate-mode buttons with (currently) just an onpress1 handler for
-- the left button.
--
-- Buttons can nest in principle, though I haven't actually used that yet.
--
-- Don't rely on the order in which handlers are run. Within any widget, all
-- applicable button handlers will run. If _any_ of them returns true, the
-- event will continue to propagate elsewhere in the widget.

-- draw button and queue up event handlers
function button(State, name, params)
  if params.bg then
    love.graphics.setColor(params.bg.r, params.bg.g, params.bg.b, params.bg.a)
    love.graphics.rectangle('fill', params.x,params.y, params.w,params.h, 5,5)
  end
  if params.icon then params.icon(params) end
  table.insert(State.button_handlers, params)
end

-- process button event handlers
function mouse_press_consumed_by_any_button(State, x, y, mouse_button)
  local button_pressed = false
  local consume_press = true
  for _,ev in ipairs(State.button_handlers) do
    if x>ev.x and x<ev.x+ev.w and y>ev.y and y<ev.y+ev.h then
      if ev.onpress1 and mouse_button == 1 then
        button_pressed = true
        if ev.onpress1() then
          consume_press = false
        end
      end
    end
  end
  return button_pressed and consume_press
end