about summary refs log tree commit diff stats
Commit message (Expand)AuthorAgeFilesLines
...
* fixed two commentsarg@suckless.org2007-10-181-1/+3
* removed dwm.h, just include C-files in config.h if you extend dwm, that's sim...arg@suckless.org2007-10-183-194/+190
* small cosmetic fixarg@suckless.org2007-10-171-2/+1
* uncommented DEBUG CFLGAS/LDFLAGSarg@suckless.org2007-10-171-2/+2
* just making dwm.h sanerarg@suckless.org2007-10-173-65/+63
* applied Eric Mertens patch to mainstream dwm, however this needs testingAnselm R. Garbe2007-10-161-28/+31
* cleaned up dwm.c/dwm.h somewhat that it allows easier integration of patchesAnselm R. Garbe2007-10-162-115/+115
* small commentAnselm R. Garbe2007-10-111-0/+1
* recreated dwm.hAnselm R. Garbe2007-10-113-21/+23
* added Mod1-Tab description to dwm.1Anselm R. Garbe2007-10-101-0/+3
* added antoszka's viewprev patch with some minor modifications, restored Clien...Anselm R. Garbe2007-10-103-22/+35
* applied Brandon MacDone's static initialization patch for seltags and Client-...Anselm R. Garbe2007-10-061-23/+21
* removing NULL-terminating **tags definition in config.hAnselm R. Garbe2007-10-052-2/+2
* removed two spaces reported by SoleenAnselm R. Garbe2007-10-031-2/+2
* reverted Peters patch to tile, I will discuss the reasons at dwm@Anselm R. Garbe2007-10-011-6/+3
* s/xterm/uxterm/Anselm R. Garbe2007-10-011-1/+1
* added hint for downloading dextraAnselm R. Garbe2007-10-011-0/+3
* fixed font definitionAnselm R. Garbe2007-10-011-1/+1
* fixed man pageAnselm R. Garbe2007-09-301-1/+1
* fixed an issue in Peter's patch (it is no good idea to restack() all clients ...Anselm R. Garbe2007-09-301-1/+2
* applied Peter Hartlich's border collapse patchAnselm R. Garbe2007-09-302-10/+12
* improved tile() for the RESIZEHINTS == True case, now more space is consumed ...Anselm R. Garbe2007-09-271-5/+6
* fixed colorsAnselm R. Garbe2007-09-271-3/+3
* fixed inclusion orderarg@suckless.org2007-09-271-1/+2
* updated with my favorite colorschemeAnselm R. Garbe2007-09-261-7/+6
* applied colors depend from lavishs proposalAnselm R. Garbe2007-09-251-6/+6
* switching to white normal bg, renaming tag 9 into www, for static use in conj...Anselm R. Garbe2007-09-231-9/+9
* btw 4.6 will be the next releaseAnselm R. Garbe2007-09-231-1/+1
* renamed config.h into config.def.h, config.h will be created if not present, ...Anselm R. Garbe2007-09-232-1/+5
* introduced ISTILE, which can be easily extended with other layout functions t...Anselm R. Garbe2007-09-222-6/+7
* setmwfact and zoom check isarrange(floating) now, not !isarrange(tile) - this...Anselm R. Garbe2007-09-221-2/+2
* Added tag 4.5 for changeset 2acc60d6dfe2Anselm R. Garbe2007-09-221-0/+1
* cosmetic fix 4.5Anselm R. Garbe2007-09-221-1/+2
* fixed a commentAnselm R. Garbe2007-09-201-1/+1
* applied Peters patch, applied yiyus hint to initfontarg@suckless.org2007-09-191-12/+12
* applied Peter Hartlich's togglemax patch to allow toggling tiled clients to m...Anselm R. Garbe2007-09-182-4/+13
* made all stuff non-static - so you can choose wether to use dwm the static or...arg@suckless.org2007-09-174-187/+184
* there might be envs which need Xlib.hAnselm R. Garbe2007-09-161-0/+1
* Mod1-Button2 on a floating but not-fixed client will make it tiled againAnselm R. Garbe2007-09-162-3/+7
* now tiled windows can be resized/moved, their floating state will be toggled ...Anselm R. Garbe2007-09-162-8/+12
* some more rearrangementsAnselm R. Garbe2007-09-161-147/+143
* ordered all functions alphabeticallyAnselm R. Garbe2007-09-161-1025/+1023
* corrected a misleading commentAnselm R. Garbe2007-09-161-1/+1
* macros which have been defined in config.h can only be used at function level...Anselm R. Garbe2007-09-161-6/+10
* ordered function forward definitionsAnselm R. Garbe2007-09-151-56/+57
* backporting my intro-comment of old dwm.hAnselm R. Garbe2007-09-151-1/+30
* removed grabkeys, not necessaryAnselm R. Garbe2007-09-151-26/+21
* micromizing dwm step 1Anselm R. Garbe2007-09-1513-1971/+1861
* new colorscheme (16-bit compliant)Anselm R. Garbe2007-09-154-15/+14
* moved bar-related stuff to bar.c (merged draw.c into that)Anselm R. Garbe2007-09-156-259/+269
ting source code from within the app' href='/akkartik/view.love/commit/run.lua?id=e1c5a42f311fdafd88506726bbe480f3fcc2d1a3'>e1c5a42 ^
0b1c47f ^


e1c5a42 ^















bca7f82 ^
7f4c5f8 ^
e1c5a42 ^
5cada8c ^
e1c5a42 ^

14c08f9 ^
e1c5a42 ^



14c08f9 ^

aa9a0b0 ^
14c08f9 ^



e8ec872 ^
e1c5a42 ^
5afe11a ^
e8ec872 ^
e1c5a42 ^

2b3e09c ^
e1c5a42 ^
2b3e09c ^
e1c5a42 ^

a6dcfc5 ^
99faf61 ^
a6dcfc5 ^
99faf61 ^

2b3e09c ^
e1c5a42 ^
2b3e09c ^
e1c5a42 ^

2b3e09c ^
e1c5a42 ^
2b3e09c ^
e1c5a42 ^

2b3e09c ^
e1c5a42 ^
2b3e09c ^
e1c5a42 ^

4ab901c ^

e1c5a42 ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202







                                                 





                            
                





                                     
                                                                  




                                              


                                 
     
                               



                                                                                        

                                                              

 









                                                     




                         
                            
                                                          

                                                               
                                   
                                                                       
                                                                          
                                                 
                                                                                                                                                                




                                                









                                                                                     

                                          
                                                 
                                  
                                                                                                                                              


                           
                                         








                                                                             
                                                                           
                                   
                                                                          











                                                                                       
                            










                                                       

                                            



                                                                                        
                                                              


 















                                
                                           
                                                                       
          
                                                                   

                                                     
                                               



                                                                    

                                
                                



             
                                           
                                                                         
                                                                        
                                                          

   
                                             
                                                                         
                                                            

   
                                    
                                                                         
                                                   

   
                          
                                                                         
                                         

   
                                       
                                                                         
                                                      

   
                                       
                                                                         
                                                      

   

                                            
   
run = {}

Editor_state = {}

-- called both in tests and real run
function run.initialize_globals()
  -- tests currently mostly clear their own state

  -- blinking cursor
  Cursor_time = 0
end

-- called only for real run
function run.initialize(arg)
  log_new('run')
  if Settings then
    run.load_settings()
  else
    run.initialize_default_settings()
  end

  if #arg > 0 and Editor_state.filename ~= absolutize(arg[1]) then
    Editor_state.filename = arg[1]
    load_from_disk(Editor_state)
    Text.redraw_all(Editor_state)
    Editor_state.screen_top1 = {line=1, pos=1}
    Editor_state.cursor1 = {line=1, pos=1}
  else
    load_from_disk(Editor_state)
    Text.redraw_all(Editor_state)
  end
  edit.check_locs(Editor_state)



  -- keep a few blank lines around: https://merveilles.town/@akkartik/110084833821965708
  love.window.setTitle('lines.love - '..Editor_state.filename)



  if #arg > 1 then
    print('ignoring commandline args after '..arg[1])
  end

  if rawget(_G, 'jit') then
    jit.off()
    jit.flush()
  end
end

function print_and_log(s)
  print(s)
  log(3, s)
end

function run.load_settings()
  local font = love.graphics.newFont(Settings.font_height)
  -- set up desired window dimensions and make window resizable
  _, _, App.screen.flags = App.screen.size()
  App.screen.flags.resizable = true
  App.screen.width, App.screen.height = Settings.width, Settings.height
  App.screen.resize(App.screen.width, App.screen.height, App.screen.flags)
  run.set_window_position_from_settings(Settings)
  Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width-Margin_right, font, Settings.font_height, math.floor(Settings.font_height*1.3))
  Editor_state.filename = Settings.filename
  Editor_state.screen_top1 = Settings.screen_top
  Editor_state.cursor1 = Settings.cursor
end

function run.set_window_position_from_settings(settings)
  local os = love.system.getOS()
  if os == 'Linux' then
    -- love.window.setPosition doesn't quite seem to do what is asked of it on Linux.
    App.screen.move(settings.x, settings.y-37, settings.displayindex)
  else
    App.screen.move(settings.x, settings.y, settings.displayindex)
  end
end

function run.initialize_default_settings()
  local font_height = 20
  local font = love.graphics.newFont(font_height)
  run.initialize_window_geometry()
  Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width-Margin_right, font, font_height, math.floor(font_height*1.3))
  Settings = run.settings()
end

function run.initialize_window_geometry()
  -- Initialize window width/height and make window resizable.
  --
  -- I get tempted to have opinions about window dimensions here, but they're
  -- non-portable:
  --  - maximizing doesn't work on mobile and messes things up
  --  - maximizing keeps the title bar on screen in Linux, but off screen on
  --    Windows. And there's no way to get the height of the title bar.
  -- It seems more robust to just follow LÖVE's default window size until
  -- someone overrides it.
  App.screen.width, App.screen.height, App.screen.flags = App.screen.size()
  App.screen.flags.resizable = true
  App.screen.resize(App.screen.width, App.screen.height, App.screen.flags)
end

function run.resize(w, h)
--?   print(("Window resized to width: %d and height: %d."):format(w, h))
  App.screen.width, App.screen.height = w, h
  Text.redraw_all(Editor_state)
  Editor_state.selection1 = {}  -- no support for shift drag while we're resizing
  Editor_state.right = App.screen.width-Margin_right
  Editor_state.width = Editor_state.right-Editor_state.left
  Text.tweak_screen_top_and_cursor(Editor_state, Editor_state.left, Editor_state.right)
end

function run.file_drop(file)
  -- first make sure to save edits on any existing file
  if Editor_state.next_save then
    save_to_disk(Editor_state)
  end
  -- clear the slate for the new file
  App.initialize_globals()
  Editor_state.filename = file:getFilename()
  file:open('r')
  Editor_state.lines = load_from_file(file)
  file:close()
  Text.redraw_all(Editor_state)
  Editor_state.screen_top1 = {line=1, pos=1}
  Editor_state.cursor1 = {line=1, pos=1}



  -- keep a few blank lines around: https://merveilles.town/@akkartik/110084833821965708
  love.window.setTitle('lines.love - '..Editor_state.filename)



end

function run.draw()
  edit.draw(Editor_state)
end

function run.update(dt)
  Cursor_time = Cursor_time + dt
  edit.update(Editor_state, dt)
end

function run.quit()
  edit.quit(Editor_state)
end

function run.settings()
  if Settings == nil then Settings = {} end
  Settings.x, Settings.y, Settings.displayindex = App.screen.position()
  return {
    x=Settings.x, y=Settings.y, displayindex=Settings.displayindex,
    width=App.screen.width, height=App.screen.height,
    font_height=Editor_state.font_height,
    filename=absolutize(Editor_state.filename),
    screen_top=Editor_state.screen_top1, cursor=Editor_state.cursor1
  }
end

function absolutize(path)
  if is_relative_path(path) then
    return App.current_dir..path
  end
  return path
end

function run.mouse_press(x,y, mouse_button)
  Cursor_time = 0  -- ensure cursor is visible immediately after it moves
  love.keyboard.setTextInput(true)  -- bring up keyboard on touch screen
  return edit.mouse_press(Editor_state, x,y, mouse_button)
end

function run.mouse_release(x,y, mouse_button)
  Cursor_time = 0  -- ensure cursor is visible immediately after it moves
  return edit.mouse_release(Editor_state, x,y, mouse_button)
end

function run.mouse_wheel_move(dx,dy)
  Cursor_time = 0  -- ensure cursor is visible immediately after it moves
  return edit.mouse_wheel_move(Editor_state, dx,dy)
end

function run.text_input(t)
  Cursor_time = 0  -- ensure cursor is visible immediately after it moves
  return edit.text_input(Editor_state, t)
end

function run.keychord_press(chord, key)
  Cursor_time = 0  -- ensure cursor is visible immediately after it moves
  return edit.keychord_press(Editor_state, chord, key)
end

function run.key_release(key, scancode)
  Cursor_time = 0  -- ensure cursor is visible immediately after it moves
  return edit.key_release(Editor_state, key, scancode)
end

function width(s)
  return love.graphics.getFont():getWidth(s)
end