Re: [MSEide-MSEgui-talk] [PATCH 1/1] editor - allow to comment line without selection

2021-03-08 Thread fredvs
Graeme Geldenhuys wrote
> On 07/03/2021 12:58 pm, fredvs wrote:
>> Nice (but you are mse-org member so no need to request, just push it).
> 
> I forgot I have read/write access. I've pushed my changes.
> 
> Regards,
>   Graeme

Thanks!

Fre;D




--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] [PATCH 1/1] editor - allow to comment line without selection

2021-03-08 Thread Graeme Geldenhuys
On 07/03/2021 12:58 pm, fredvs wrote:
> Nice (but you are mse-org member so no need to request, just push it).
> 
> By the way, I did commit your code for ideU.

I forgot I have read/write access. I've pushed my changes.

Regards,
  Graeme

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] [PATCH 1/1] editor - allow to comment line without selection

2021-03-07 Thread fredvs
 
Graeme Geldenhuys wrote
> I'll make the remaining changes today and created a pull request for code
> review.

Hello Graeme.

Nice (but you are mse-org member so no need to request, just push it).

By the way, I did commit your code for ideU.

Fre;D






--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] [PATCH 1/1] editor - allow to comment line without selection

2021-03-07 Thread Graeme Geldenhuys
On 07/03/2021 2:20 am, fredvs wrote:
> But if doing this, imho, tactionsmo.enablecomment has no sense anymore and
> should be commented.

My initial thoughts was not to change existing behaviour, but you are 100%
correct. That action doesn't make sense any more - in fact I did not even
know that right-click popup menu or the action existed.

I'll make the remaining changes today and created a pull request for code
review.

Regards,
  Graeme

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] [PATCH 1/1] editor - allow to comment line without selection

2021-03-06 Thread fredvs
Hello Graeme.

Indeed, much better.

But if doing this, imho, tactionsmo.enablecomment has no sense anymore and
should be commented.
Otherwise if you use the right-click to show the properties-list, "comment"
will be disabled if nothing was selected.

procedure tactionsmo.enablecomment(const sender: tcustomaction);
begin
// enableonselect(sender);
// sender.enabled:= sender.enabled and  sourcefo.activepage.cancomment();
end;

Fre;D



--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


[MSEide-MSEgui-talk] [PATCH 1/1] editor - allow to comment line without selection

2021-03-06 Thread Graeme Geldenhuys
Hi,

Attached is a patch to add new functionality to the text editor. Every
programmer editor I have ever used allows you to comment a line of code
*without* first having to make a selection.

Old behaviour: To comment a line, you had to first select the whole
  line, starting at column 1 and the text cursor must end on the
  following line.

New behaviour: The old selection option still exists, but there is an
  additional behaviour added. If no selection was made, the editor
  will simply comment the current line the text cursor is on. Adding the
  comment markers at the beginning of the line.

---

Graeme Geldenhuys (1):
  Allows you to comment a line without first having to make whole line
selections.

 apps/ide/sourcepage.pas | 13 +++--
 1 file changed, 11 insertions(+), 2 deletions(-)

-- 
2.17.1



Regards,
  Graeme
>From 40ad0da83dd9be1e06b8a8aa4e43dd102682a5ae Mon Sep 17 00:00:00 2001
From: Graeme Geldenhuys 
Date: Sun, 7 Mar 2021 00:19:20 +
Subject: [PATCH 1/1] Allows you to comment a line without first having to make
 whole line selections.

Every text editor I know allows for this. Not sure how this was
overlooked in mseIDE.
---
 apps/ide/sourcepage.pas | 13 +++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/apps/ide/sourcepage.pas b/apps/ide/sourcepage.pas
index 4326bc0f2..40dc8a5af 100644
--- a/apps/ide/sourcepage.pas
+++ b/apps/ide/sourcepage.pas
@@ -1771,8 +1771,10 @@ var
  mstr1: msestring;
  i1: int32;
  start,stop: int32;
+ gc1: gridcoordty;
 begin
- if cancomment() then begin
+ if cancomment() then // must have lines selected
+ begin
   edit.getselectedrows(start,stop);
   edit.editor.begingroup();
   mstr1:= edit.selectedtext;
@@ -1787,7 +1789,7 @@ begin
 if mstr1[i1] = #0 then begin
  break;
 end;
-insert('//',mstr1,i1);
+insert('//',mstr1,i1);
end;
inc(i1);
   end;
@@ -1797,6 +1799,13 @@ begin
   grid.endupdate();
   edit.editor.endgroup();
   edit.refreshsyntax(start,stop-start);
+ end
+ else
+ begin // comment line - no selection needed
+   gc1 := edit.editpos;
+   mstr1 := edit.datalist.items[gc1.row];
+   edit.datalist.items[gc1.row] := '//' + mstr1;
+   edit.col := edit.col + 2; // advance edit cursor due to inserted text
  end;
 end;
 
-- 
2.17.1

___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk