Skip to content

Commit 89b4edb

Browse files
committed
Delete Column added to table-specific commands
1 parent 0a4a9c8 commit 89b4edb

11 files changed

+81
-34
lines changed

APLSource/Meddy/CreateContextMenuOnMarkdown.aplf

+6
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,12 @@
113113
m.MoveColLeft.onSelect←1
114114
m.MoveColLeft.Active←(Tables.CheckForCursorIsInTable n)∧=/↑¨n.Markdown.SelText
115115

116+
∆←''
117+
∆,←⊂'Caption'('Delete current column',TAB,'Ctrl+Del')
118+
m.DeleteCol←m.⎕NEW'MenuItem'∆
119+
m.DeleteCol.onSelect←1
120+
m.DeleteCol.Active←(Tables.CheckForCursorIsInTable n)∧=/↑¨n.Markdown.SelText
121+
116122
∆←''
117123
∆,←⊂'Caption'('Extend current line',TAB,'Ctrl+Shift+E')
118124
m.ExtendCurrentLine←m.⎕NEW'MenuItem'∆

APLSource/Meddy/History.apla

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
(
2-
'* 3.1.0 - 2022-08-13'
3-
' '
2+
'* 3.1.0 - 2022-08-14'
3+
''
4+
' * "Delete column" added to the table-specific commands '
45
' * New version of MarkAPL with improved styling of TOCs and inline code'
56
' * Bug fixes'
67
' * Opening a Markdown file that had no HTML companion yet crashed'
+20-17
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,43 @@
1-
{r}←n OnKeyPressInMarkdown msg;hasFocus;row;key;cl;buff
1+
{r}←n OnKeyPressInMarkdown msg;hasFocus;row;key;cl;buff;keyAndState
22
r←1
33
key←,2⊃msg
44
hasFocus←2 ⎕NQ #'GetFocusObj'
55
:If 3<≢msg
6-
:If 9 1≡msg[4 5] ⍝ Shift+Tab?!
6+
keyAndState←msg[4 5]
7+
:If 9 1≡keyAndState ⍝ Shift+Tab?!
78
n.Markdown.SelText←2⍴n.Markdown.SelText[1]
89
⍝{}1 ⎕NQ n.Toc'ItemUp'(n.Toc.SelItems⍳1)0 0 8
910
0 ScrollToInMarkdown n(n.Toc.SelItems⍳1)
1011
{}⎕NQ n.Toc'GotFocus'
1112
n.(Row Col).Text←⊂''
1213
r←0
1314
:Return
14-
:ElseIf 107 2≡msg[4 5] ⍝ Ctrl++?!
15+
:ElseIf 107 2≡keyAndState ⍝ Ctrl++?!
1516
n ChangeFontSize 1
16-
:ElseIf 109 2≡msg[4 5] ⍝ Ctrl+-?!
17+
:ElseIf 109 2≡keyAndState ⍝ Ctrl+-?!
1718
n ChangeFontSize ¯1
18-
:ElseIf 9 2≡msg[4 5] ⍝ Ctrl+Tab
19+
:ElseIf 9 2≡keyAndState ⍝ Ctrl+Tab
1920
r←'Right'Tables.JumpOneColumn n
20-
:ElseIf 9 3≡msg[4 5] ⍝ Ctrl+Shift+Tab
21+
:ElseIf 9 3≡keyAndState ⍝ Ctrl+Shift+Tab
2122
r←'Left'Tables.JumpOneColumn n
22-
:ElseIf 120 2≡msg[4 5] ⍝ Ctrl+F9 (insert column)
23+
:ElseIf 120 2≡keyAndState ⍝ Ctrl+F9 (insert column)
2324
r←'Right'Tables.InsertColumn n
24-
:ElseIf 120 3≡msg[4 5] ⍝ Ctrl+Shift+F9 (insert column)
25+
:ElseIf 120 3≡keyAndState ⍝ Ctrl+Shift+F9 (insert column)
2526
r←'Left'Tables.InsertColumn n
26-
:ElseIf 38 3≡msg[4 5] ⍝ Ctrl+Shift+<up>
27+
:ElseIf 38 3≡keyAndState ⍝ Ctrl+Shift+<up>
2728
r←'Up'Tables.MoveRow n
28-
:ElseIf 40 3≡msg[4 5] ⍝ Ctrl+Shift+<down>
29+
:ElseIf 40 3≡keyAndState ⍝ Ctrl+Shift+<down>
2930
r←'Down'Tables.MoveRow n
30-
:ElseIf 116 2≡msg[4 5] ⍝ Ctrl+F5
31+
:ElseIf 116 2≡keyAndState ⍝ Ctrl+F5
3132
r←'Right'Tables.MoveCol n
32-
:ElseIf 115 2≡msg[4 5] ⍝ Ctrl+F4
33+
:ElseIf 115 2≡keyAndState ⍝ Ctrl+F4
3334
r←'Left'Tables.MoveCol n
34-
:ElseIf 86 3≡msg[4 5] ⍝ Ctrl+Shift+V
35+
:ElseIf 86 3≡keyAndState ⍝ Ctrl+Shift+V
3536
r←Tables.PasteTable n
36-
:ElseIf 69 3≡msg[4 5] ⍝ Ctrl+Shift+E
37+
:ElseIf 69 3≡keyAndState ⍝ Ctrl+Shift+E
3738
r←Tables.ExtendCurrentLine n
39+
:ElseIf 46 2≡keyAndState ⍝ Ctrl+Delete
40+
r←Tables.DeleteCol n
3841
:ElseIf 2=≢key
3942
:Select key
4043
:Case 'HT'
@@ -48,14 +51,14 @@
4851
PolishClipboard ⍬
4952
:EndSelect
5053
:ElseIf 0=≢key
51-
r←4=msg[5] ⍝ "Alt" key?!
54+
r←4=msg[5] ⍝ "Alt" key?!
5255
:EndIf
5356
n.StatusField1.Text←''
5457
n.StatusField1.BCol←0
5558
:EndIf
5659
:If 3=≢msg
57-
:OrIf 4≠5⊃msg ⍝ Ony when no ALT key is pressed
60+
:OrIf 4≠5⊃msg ⍝ Ony when no ALT key is pressed
5861
:Trap 0 ⋄ ⎕NQ hasFocus'GotFocus' ⋄ :EndTrap
59-
⎕NQ n.∆Form 9999 ⍝ Sets Row and Col in Statusbar, preserve data for undo/redo
62+
⎕NQ n.∆Form 9999 ⍝ Sets Row and Col in Statusbar, preserve data for undo/redo
6063
:EndIf
6164
⍝Done

APLSource/Meddy/ProcessContextMenuOnMarkdown.aplf

+2
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343
Tables.PasteTable n
4444
:Case contextMenu.ExtendCurrentLine
4545
Tables.ExtendCurrentLine n
46+
:Case contextMenu.DeleteCol
47+
Tables.DeleteCol n
4648
:Else
4749
:If menuItem∊contextMenu.(cut copy paste)
4850
contextMenu SendKeystroke n menuItem

APLSource/Meddy/Tables/DeleteCol.aplf

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{r}←DeleteCol n;table;ind;currentCol;curPos;row;col;selText;buff;parms
2+
r←0
3+
:If =/↑¨selText←n.Markdown.SelText
4+
curPos←¯1+0 0⊃n.Markdown.SelText ⍝ Where is the cursor?
5+
:AndIf n CursorIsInTable curPos ⍝ Is it inside a table?
6+
(table ind)←FormatTableInMarkdown n
7+
:AndIf ⍬≢table
8+
:If 0=≢1⊃⍴table
9+
parms←##.G.Dialogs.CreateParmsForShowMsg
10+
parms.caption←'Meddy'
11+
parms ##.G.Dialogs.ShowMsg'You cannot delete the very last column of a table'
12+
:Else
13+
(row col)←¯1+0⊃n.Markdown.SelText
14+
currentCol←↑¯1↑col↑¯1++\'|'=(↑ind)⊃n.Markdown.Text
15+
table←table[;currentCol~⍨⍳1⊃⍴table]
16+
buff←'|',(↑⊃¨{⍺,'|',⍵}/⊃¨↓⍉table),'|'
17+
n.Markdown.Text[ind]←↓buff
18+
n.Markdown.SelText←selText
19+
:EndIf
20+
:EndIf
21+
⍝Done

APLSource/Meddy/Tables/FormatTableInMarkdown.aplf

+1-5
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,7 @@
1717
table←##.TAB ⎕R' '⊣table ⍝ Replace TABs by four spaces
1818
table2←{' '@(1+⍸'\|'⍷⍵)⊣⍵}¨table ⍝ Replace escaped pipes by spaces (again)
1919
table2←{b←~##.GetMaskForCode ⍵ ⋄ b\b/⍵}¨table2 ⍝ Replace code by spaces (again)
20-
headerRow←1 ⍝ Index of the column devider (MarkAPL allows the absence of col headers)
21-
:If 0=hasColHeaders←((headerRow⊃table)~'| :')∧.='-' ⍝ Does the table have column headers?
22-
headerRow←0
23-
hasColHeaders←((headerRow⊃table)~'| :')∧.='-' ⍝ In case there are no column headers but column deviders for alignment
24-
:EndIf
20+
hasColHeaders←⍬≢headerRow←GetHeaderRow table
2521
footerRow←''
2622
:If hasFooter←2<≢table ⍝ Does the table
2723
:AndIf ~hasFooter←(((footerRow←¯2+≢table2)⊃table)~'| ')∧.='=' ⍝ ... has somewhere ...
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
headerRow←GetHeaderRow table;hasColHeaders
2+
⍝ Returns the row of the header, if any. 1 or 2 if there is one, and ⍬ otherwise
3+
headerRow←1 ⍝ Index of the column devider (MarkAPL allows the absence of col headers)
4+
:If 0=hasColHeaders←((headerRow⊃table)~'| :')∧.='-' ⍝ Does the table have column headers?
5+
headerRow←0
6+
hasColHeaders←((headerRow⊃table)~'| :')∧.='-' ⍝ In case there are no column headers but column deviders for alignment
7+
:EndIf
8+
:If ~hasColHeaders
9+
headerRow←⍬
10+
:EndIf

APLSource/Meddy/Version.aplf

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
r←Version
22
⍝ See `History`
3-
r←'Meddy' '3.1.0+449' '2023-08-13'
3+
r←'Meddy' '3.1.0+452' '2023-08-14'

Docs/ReleaseNotes.md

+7-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@ Release Notes
22
=============
33

44

5-
## 3.1.0 - 2023-08-13
6-
* New version of MarkAPL with improved styling of TOCs and inline code
7-
* Bug fix: opening a Markdown file that had no HTML companion yet crashed
5+
## 3.1.0 - 2023-08-14
6+
7+
* "Delete column" added to the table-specific commands
8+
* New version of MarkAPL integrated with improved styling of TOCs and inline code
9+
* Bug fixes
10+
* Opening a Markdown file that had no HTML companion yet crashed
811

912
## 3.0.1 - 2023-08-11
1013

@@ -87,3 +90,4 @@ Release Notes
8790

8891

8992

93+

HTML/ReleaseNotes.html

+9-5
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<div class="toc-container">
1818
<h3>Table of contents</h3>
1919
<ul>
20-
<li><a href="#310---2023-08-13">1. 3.1.0 - 2023-08-13</a></li>
20+
<li><a href="#310---2023-08-14">1. 3.1.0 - 2023-08-14</a></li>
2121
<li><a href="#301---2023-08-11">2. 3.0.1 - 2023-08-11</a></li>
2222
<li><a href="#300---2023-07-31">3. 3.0.0 - 2023-07-31</a></li>
2323
<li><a href="#2111---2020-08-24">4. 2.11.1 - 2020-08-24</a></li>
@@ -35,13 +35,17 @@ <h1 data-id="Release-Notes">Release Notes</h1>
3535
</a>
3636
</div>
3737
<div class="h_tag">
38-
<a href="#310---2023-08-13" id="310---2023-08-13" class="autoheader_anchor">
39-
<h2 data-id="310---2023-08-13">1. 3.1.0 - 2023-08-13</h2>
38+
<a href="#310---2023-08-14" id="310---2023-08-14" class="autoheader_anchor">
39+
<h2 data-id="310---2023-08-14">1. 3.1.0 - 2023-08-14</h2>
4040
</a>
4141
</div>
4242
<ul>
43-
<li>New version of MarkAPL with improved styling of TOCs and inline code</li>
44-
<li>Bug fix: opening a Markdown file that had no HTML companion yet crashed</li>
43+
<li>“Delete column” added to the table-specific commands</li>
44+
<li>New version of MarkAPL integrated with improved styling of TOCs and inline code</li>
45+
<li>Bug fixes
46+
<ul>
47+
<li>Opening a Markdown file that had no HTML companion yet crashed</li>
48+
</ul></li>
4549
</ul>
4650
<div class="h_tag">
4751
<a href="#301---2023-08-11" id="301---2023-08-11" class="autoheader_anchor">

Meddy.iss

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
; This script is best executed by Meddy's "Make" utility.
22

3-
#define MyAppVersion "3.1.0+449"
3+
#define MyAppVersion "3.1.0+452"
44
#define MyAppName "Meddy"
55
#define MyAppExeName "Meddy.exe"
66
#define MyAppPublisher "Kai Jaeger"

0 commit comments

Comments
 (0)