about summary refs log tree commit diff stats
path: root/src/tools
Commit message (Expand)AuthorAgeFilesLines
* fix memory leakSteffen Jaeckel2023-04-041-9/+8
* Editor executable support flagsDaniel Santos2023-03-301-1/+6
* Adapt to g_string_free glib 2.75.3 changeMichael Vetter2023-03-212-11/+2
* Fix duplicate download IDs.IsaacM882023-03-096-19/+24
* Fix quote and url autocompletion for MAM and historyMarcoPolo-PasTonMolo2023-02-132-3/+8
* fix more memory leaksSteffen Jaeckel2023-01-181-1/+1
* minor changesSteffen Jaeckel2023-01-181-40/+9
* Update copyright yearMichael Vetter2023-01-106-6/+6
* Spawn external programs asynchronouslyMarouane L2022-10-122-2/+2
* Tell user where the downloaded file is storedSteffen Jaeckel2022-09-071-2/+2
* Include common.h and xmpp.h in editor.cMichael Vetter2022-06-281-0/+2
* Include xmpp.h in bookmark_ignore.cMichael Vetter2022-06-281-0/+2
* Improve cmd argument parserMarcoPolo-PasTonMolo2022-06-161-3/+12
* Update copyright yearMichael Vetter2022-05-094-4/+4
* Fix a segfault when uploading or downloading filesMaxi Wuttke2022-04-022-2/+2
* Fix crash on /editorMarcoPolo-PasTonMolo2022-03-241-1/+5
* apply `tls.policy` to cURL callsSteffen Jaeckel2022-03-222-0/+14
* add profanity-specific CAfileSteffen Jaeckel2022-03-222-0/+12
* re-factor `get_message_from_editor()`Steffen Jaeckel2022-03-141-62/+50
* prevent segfaultSteffen Jaeckel2022-03-131-0/+3
* Add stat.h to editorMichael Vetter2022-03-041-0/+1
* Include errno header in editor.cMichael Vetter2022-03-041-1/+2
* Move get_message_from_editor to appropriate file and change its keybindingMarcoPolo-PasTonMolo2022-03-032-0/+176
* auto-formatSteffen Jaeckel2022-02-011-1/+1
* Format code correctlyMichael Vetter2021-10-051-1/+1
* Fix segfault when aesgcm url isn't the expected sizeMichael Vetter2021-06-301-0/+1
* http upload: use correct content typeMichael Vetter2021-06-021-1/+1
* Get rid of asprintf and _GNU_SOURCE defineMichael Vetter2021-03-305-51/+49
* Add config.h in files were it was missingMichael Vetter2021-03-263-0/+6
* autocomplete: remove duplicate code in search functionsMichael Vetter2021-03-111-54/+16
* autocomplete: Use asprintf don't calculate length twiceMichael Vetter2021-03-111-4/+9
* Remove duplicate code in autocomplete_param*Michael Vetter2021-03-111-29/+22
* Upload: Fix unused returnThorben Günther2021-03-111-4/+9
* Update to the newest version of XEP 0363 (HTTP Upload)Maximilian Wuttke2021-03-112-0/+32
* Update copyrightMichael Vetter2021-01-082-2/+2
* Fix deadlock on error before HTTP download has begunWilliam Wennerström2020-12-101-4/+6
* Remove cmd_tiny, empty files and link nonce with IVWilliam Wennerström2020-12-073-2/+2
* Add tests for format_call_external_argvWilliam Wennerström2020-12-071-2/+2
* Fix bad order of parameters for url saveWilliam Wennerström2020-12-071-1/+7
* Rework url to filenameWilliam Wennerström2020-12-062-8/+6
* Move unique_filename_from_url functions to commonWilliam Wennerström2020-12-042-21/+0
* Refactor for threaded external executable for built-in download methodsWilliam Wennerström2020-12-035-2/+45
* Fix stubs and move some tests to http_commonWilliam Wennerström2020-11-162-18/+12
* Switch to g_strerrorWilliam Wennerström2020-11-162-23/+19
* Move common http tool code to http_commonWilliam Wennerström2020-11-166-53/+154
* Add I/O error handling and use filenames instead of file descriptorsWilliam Wennerström2020-11-164-51/+87
* Refactor OMEMO download into AESGCMDownload toolWilliam Wennerström2020-11-166-2/+221
* Run make format on rebaseWilliam Wennerström2020-11-164-57/+64
* Remove unsafe Conent-Disposition inferringWilliam Wennerström2020-11-162-119/+19
* Infer filename from content-disposition or URLWilliam Wennerström2020-11-162-7/+123
">:environment <- new-programming-environment resources, screen, [] render-all screen, env, render # run a few commands assume-console [ left-click 1, 75 type [divide-with-remainder 11, 3] press F4 type [add 2, 2] press F4 ] event-loop screen, console, env, resources screen-should-contain [ . run (F4) . . . .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊─────────────────────────────────────────────────. . 0 edit copy to recipe delete . . add 2, 2 . . 4 . . ┊─────────────────────────────────────────────────. . 1 edit copy to recipe delete . . divide-with-remainder 11, 3 . . 3 . . 2 . . ┊─────────────────────────────────────────────────. . . ] # delete second sandbox by clicking on left edge of 'delete' button assume-console [ left-click 7, 90 ] run [ event-loop screen, console, env, resources ] screen-should-contain [ . run (F4) . . . .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊─────────────────────────────────────────────────. . 0 edit copy to recipe delete . . add 2, 2 . . 4 . . ┊─────────────────────────────────────────────────. . . . . ] # delete first sandbox by clicking at right edge of 'delete' button assume-console [ left-click 3, 99 ] run [ event-loop screen, console, env, resources ] screen-should-contain [ . run (F4) . . . .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊─────────────────────────────────────────────────. . . . . ] ] after <global-touch> [ # support 'delete' button { delete?:bool <- should-attempt-delete? click-row, click-column, env break-unless delete? delete?, env <- try-delete-sandbox click-row, env break-unless delete? screen <- render-sandbox-side screen, env, render screen <- update-cursor screen, recipes, current-sandbox, sandbox-in-focus?, env loop +next-event } ] # some preconditions for attempting to delete a sandbox def should-attempt-delete? click-row:num, click-column:num, env:&:environment -> result:bool [ local-scope load-inputs # are we below the sandbox editor? click-sandbox-area?:bool <- click-on-sandbox-area? click-row, click-column, env return-unless click-sandbox-area?, false # narrower, is the click in the columns spanning the 'copy' button? first-sandbox:&:editor <- get *env, current-sandbox:offset assert first-sandbox, [!!] sandbox-left-margin:num <- get *first-sandbox, left:offset sandbox-right-margin:num <- get *first-sandbox, right:offset _, _, _, _, _, _, delete-button-left:num <- sandbox-menu-columns sandbox-left-margin, sandbox-right-margin result <- within-range? click-column, delete-button-left, sandbox-right-margin ] def try-delete-sandbox click-row:num, env:&:environment -> clicked-on-delete-button?:bool, env:&:environment [ local-scope load-inputs # identify the sandbox to delete, if the click was actually on the 'delete' button sandbox:&:sandbox <- find-sandbox env, click-row return-unless sandbox, false clicked-on-delete-button? <- copy true env <- delete-sandbox env, sandbox ] def delete-sandbox env:&:environment, sandbox:&:sandbox -> env:&:environment [ local-scope load-inputs curr-sandbox:&:sandbox <- get *env, sandbox:offset first-sandbox?:bool <- equal curr-sandbox, sandbox { # first sandbox? pop break-unless first-sandbox? next-sandbox:&:sandbox <- get *curr-sandbox, next-sandbox:offset *env <- put *env, sandbox:offset, next-sandbox } { # not first sandbox? break-if first-sandbox? prev-sandbox:&:sandbox <- copy curr-sandbox curr-sandbox <- get *curr-sandbox, next-sandbox:offset { assert curr-sandbox, [sandbox not found! something is wrong.] found?:bool <- equal curr-sandbox, sandbox break-if found? prev-sandbox <- copy curr-sandbox curr-sandbox <- get *curr-sandbox, next-sandbox:offset loop } # snip sandbox out of its list next-sandbox:&:sandbox <- get *curr-sandbox, next-sandbox:offset *prev-sandbox <- put *prev-sandbox, next-sandbox:offset, next-sandbox } # update sandbox count sandbox-count:num <- get *env, number-of-sandboxes:offset sandbox-count <- subtract sandbox-count, 1 *env <- put *env, number-of-sandboxes:offset, sandbox-count # reset scroll if deleted sandbox was last { break-if next-sandbox render-from:num <- get *env, render-from:offset reset-scroll?:bool <- equal render-from, sandbox-count break-unless reset-scroll? *env <- put *env, render-from:offset, -1 } ] scenario deleting-sandbox-after-scroll [ local-scope trace-until 100/app # trace too long assume-screen 100/width, 10/height # initialize environment assume-resources [ ] env:&:environment <- new-programming-environment resources, screen, [] render-all screen, env, render # create 2 sandboxes and scroll to second assume-console [ press ctrl-n type [add 2, 2] press F4 type [add 1, 1] press F4 press page-down ] event-loop screen, console, env, resources screen-should-contain [ . run (F4) . . ┊─────────────────────────────────────────────────. .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊0 edit copy to recipe delete . . add 1, 1 . . 2 . . ┊─────────────────────────────────────────────────. . 1 edit copy to recipe delete . ] # delete the second sandbox assume-console [ left-click 6, 99 ] run [ event-loop screen, console, env, resources ] # second sandbox shows in editor; scroll resets to display first sandbox screen-should-contain [ . run (F4) . . ┊─────────────────────────────────────────────────. .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊0 edit copy to recipe delete . . add 1, 1 . . 2 . . ┊─────────────────────────────────────────────────. . . ] ] scenario deleting-top-sandbox-after-scroll [ local-scope trace-until 100/app # trace too long assume-screen 100/width, 10/height # initialize environment assume-resources [ ] env:&:environment <- new-programming-environment resources, screen, [] render-all screen, env, render # create 2 sandboxes and scroll to second assume-console [ press ctrl-n type [add 2, 2] press F4 type [add 1, 1] press F4 press page-down ] event-loop screen, console, env, resources screen-should-contain [ . run (F4) . . ┊─────────────────────────────────────────────────. .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊0 edit copy to recipe delete . . add 1, 1 . . 2 . . ┊─────────────────────────────────────────────────. . 1 edit copy to recipe delete . ] # delete the second sandbox assume-console [ left-click 2, 99 ] run [ event-loop screen, console, env, resources ] # second sandbox shows in editor; scroll resets to display first sandbox screen-should-contain [ . run (F4) . . ┊─────────────────────────────────────────────────. .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊0 edit copy to recipe delete . . add 2, 2 . . 4 . . ┊─────────────────────────────────────────────────. . . ] ] scenario deleting-final-sandbox-after-scroll [ local-scope trace-until 100/app # trace too long assume-screen 100/width, 10/height # initialize environment assume-resources [ ] env:&:environment <- new-programming-environment resources, screen, [] render-all screen, env, render # create 2 sandboxes and scroll to second assume-console [ press ctrl-n type [add 2, 2] press F4 type [add 1, 1] press F4 press page-down press page-down ] event-loop screen, console, env, resources screen-should-contain [ . run (F4) . . ┊─────────────────────────────────────────────────. .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊1 edit copy to recipe delete . . add 2, 2 . . 4 . . ┊─────────────────────────────────────────────────. . . ] # delete the second sandbox assume-console [ left-click 2, 99 ] run [ event-loop screen, console, env, resources ] # implicitly scroll up to first sandbox screen-should-contain [ . run (F4) . . . .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊─────────────────────────────────────────────────. . 0 edit copy to recipe delete . . add 1, 1 . . 2 . . ┊─────────────────────────────────────────────────. . . ] ] scenario deleting-updates-sandbox-count [ local-scope trace-until 100/app # trace too long assume-screen 100/width, 10/height # initialize environment assume-resources [ ] env:&:environment <- new-programming-environment resources, screen, [] render-all screen, env, render # create 2 sandboxes assume-console [ press ctrl-n type [add 2, 2] press F4 type [add 1, 1] press F4 ] event-loop screen, console, env, resources screen-should-contain [ . run (F4) . . . .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊─────────────────────────────────────────────────. . 0 edit copy to recipe delete . . add 1, 1 . . 2 . . ┊─────────────────────────────────────────────────. . 1 edit copy to recipe delete . . add 2, 2 . . 4 . ] # delete the second sandbox, then try to scroll down twice assume-console [ left-click 3, 99 press page-down press page-down ] run [ event-loop screen, console, env, resources ] # shouldn't go past last sandbox screen-should-contain [ . run (F4) . . ┊─────────────────────────────────────────────────. .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊0 edit copy to recipe delete . . add 2, 2 . . 4 . . ┊─────────────────────────────────────────────────. . . ] ]