ride icon indicating copy to clipboard operation
ride copied to clipboard

MacDyalog needs a way to query the session window height and width

Open JohnScholes opened this issue 6 years ago • 4 comments

Describe the issue you are having

The ]rows ucmd needs to know the height and width, in characters, of the session window. On Windows platforms this is achieved with a ⎕NA call and on Linux (tty) platforms it uses ⎕SD. Could MacDyalog have an equivalent, please?

In the meantime, for my 13" MacBook, where I alway have the session window as large as possible, I have developed a naughty kludge for ⎕SE.Dyalog.Out.SD:

     ∇ rc←SD;handle;GetDlgItem;GetClientRect;GetDC;ReleaseDC;GetDeviceCapsdlg;r;c;v;h;_;scal;hdc  ⍝ session window size
+      :If 'Mac'≡3↑⊃'.'⎕WG'APLVersion'  ⍝ JMS' macbook
+          →0,rc←⌈⎕pw×(33÷106),1
+      :EndIf
       :Trap 0
           ⎕NA'u user32|GetDlgItem u u'
           ⎕NA'u user32|GetClientRect u >{u u u u}'

I found that, given the aspect ratio of my session window, a font size that gives me a ⎕PW of 106 shows 33 rows in the session. This seems to scale reasonably for other font sizes.

JohnScholes avatar May 01 '18 11:05 JohnScholes

Same as #232.

jayfoad avatar May 01 '18 11:05 jayfoad

Sorry about the duplication. I ploughed through the issues but must have missed it. I suggest we close 232 and retain 378 as it explains more.

On 1 May 2018, at 12:46, jayfoad [email protected] wrote:

Same as #232 https://github.com/Dyalog/ride/issues/232.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Dyalog/ride/issues/378#issuecomment-385653680, or mute the thread https://github.com/notifications/unsubscribe-auth/AH_E503HA3WqSMevJogxplOr6Wdz80Ccks5tuEsjgaJpZM4Tt1n6.

JohnScholes avatar May 01 '18 11:05 JohnScholes

This should be straightforward, just need to agree on the protocol message. You tell me @johndaintree

e9gille avatar May 02 '18 14:05 e9gille

Can I suggest we extend the protocol with:

["GetClientRect", { "win": 123 }] //  Interpreter -> RIDE
["ReplyGetClientRect", {
  "win": 123,
  "width": 270,
  "height": 260,
  "charWidth": 45,
  "charHeight": 13
}] //  RIDE  -> Interpreter

where the response contains both the pixel size and size in chars.

e9gille avatar May 17 '18 15:05 e9gille