Menu

Text selecting

Meter
2008-01-12
2015-04-13
  • Meter

    Meter - 2008-01-12

    Just my two cents:

    I really, really like MadEdit. Congratulations on a a well-balanced design. However, I think it lacks two significant behaviors that are close to universal among text editors today -- at least Windows editors. (I have little experience with non-Windows editors.)

    (1) Selecting a line. Most editors will select a word/token with a double-click and an entire line with a triple-click. I think MadEdit needs a similar shortcut system to select an entire line. Whether it is the triple-click approach used in most editors is not critical, but I feel it really needs a shortcut (no menus!) to selecting an entire line.

    (2) Moving selected text. In most editors, you can move selected text by clicking on it and dragging it to its new location. Once you get used to it, it's hard to do without it. :-(

    Of the two, I think 1) is the much more critical. If MadEdit had (1), I would probably use it as my default editor. If it had (1) and (2) then I would have no reason to consider something else.

    Again, many thanks for publishing your program.

     
    • cfreeer

      cfreeer - 2008-02-18

      The 1) is much easier than 2), I made a patch for 1) and am still working on 2). For me, 2) is more critical.
      If any one need the patch for 1), I will post my patch.

       
      • Meter

        Meter - 2008-02-18

        Thanx fcreeer. I don't know if I will ever get around to trying to build MaxEdit from sources, but I would be interested in seeing the patch anyway. Any chance of getting the developers interested in this?

         
    • cfreeer

      cfreeer - 2008-02-19

      I am not sure what the author was busy in. I have ever touched him after his being back from his military service. But he seldom replied his email. I think the guy is a nice one but is too busy in something recently.
      If you use linux, the build will be easier than windows. Good luck.

      Diff files for src\Madedit\Madedit.cpp and .h:(Note: The ugly code was stealed from wxWidgets itself)

      File difference report generated by CSDiff by ComponentSoftware on 2/19/2008 9:13 AM

      Base file: D:\lmg\src\trunk\madedit\src\MadEdit\MadEdit.h
      Compared file: D:\MadEdit.h

      350a351,352
      >     wxMilliClock_t m_lastDoubleClick;
      >
      429a432
      >     void SelectLineFromCaretPos(wxString *ws=NULL);

      <---------------------  End of report  --------------------->

      File difference report generated by CSDiff by ComponentSoftware on 2/19/2008 9:12 AM

      Base file: D:\lmg\src\trunk\madedit\src\MadEdit\MadEdit.cpp
      Compared file: D:\MadEdit.cpp

      884a885
      >     m_lastDoubleClick = 0;
      3854a3856,3925
      > void MadEdit::SelectLineFromCaretPos(wxString *ws)
      > {
      >     if(m_EditMode == emColumnMode && m_CaretPos.extraspaces)
      >         return;
      >
      >     wxFileOffset startpos, endpos;
      >
      >     if(!IsTextFile()) // not a text file (HexMode)
      >     {
      >         startpos = m_HexRowIndex[0];
      >
      >         int count = GetVisibleHexRowCount();
      >         if(count == 0) ++count;
      >         endpos = m_HexRowIndex[count-1]+16;
      >
      >         if(endpos > m_Lines->m_Size)
      >         {
      >             endpos = m_Lines->m_Size;
      >         }
      >     }
      >     else                          //TextMode
      >     {
      >         //may select whole line
      >         startpos = m_CaretPos.pos - m_CaretPos.linepos +
      >                    m_CaretPos.iter->m_RowIndices[0].m_Start; // exclude BOM
      >         endpos = m_CaretPos.pos - m_CaretPos.linepos +
      >             m_CaretPos.iter->m_RowIndices[1].m_Start; ;
      >        
      >     }
      >
      >     m_Selection=true;
      >     m_SelectionPos1.pos = startpos;
      >     m_SelectionPos2.pos = endpos;
      >
      >     UpdateSelectionPos();
      >
      >     m_CaretPos = m_SelectionPos2;
      >
      >     m_SelectionBegin = &m_SelectionPos1;
      >     m_SelectionEnd = &m_SelectionPos2;
      >
      >     m_SelFirstRow = m_SelectionBegin->rowid;
      >     m_SelLastRow = m_SelectionEnd->rowid;
      >
      >     UpdateCaret(m_CaretPos, m_ActiveRowUChars, m_ActiveRowWidths, m_CaretRowUCharPos);
      >
      >     if(m_EditMode==emHexMode)
      >     {
      >         AppearHexRow(m_CaretPos.pos);
      >
      >         m_CaretAtHalfByte=false;
      >
      >         if(!m_CaretAtHexArea)
      >         {
      >             UpdateTextAreaXPos();
      >         }
      >     }
      >
      >     AppearCaret();
      >     UpdateScrollBarPos();
      >
      >     m_LastTextAreaXPos=m_TextAreaXPos;
      >     m_LastCaretXPos= m_CaretPos.xpos;
      >
      >     m_RepaintAll=true;
      >     Refresh(false);
      >
      >     DoSelectionChanged();
      > }
      >
      9097a9169,9175
      >         const long TRIPLECLICK_LEN = 200; // 0.2 sec after doubleclick
      >         if ( wxGetLocalTimeMillis() - m_lastDoubleClick <= TRIPLECLICK_LEN )
      >         {
      >             SelectLineFromCaretPos();
      >             return;
      >         }
      >        
      9233a9312,9313
      >    
      >     m_lastDoubleClick = wxGetLocalTimeMillis();

      <---------------------  End of report  --------------------->

       
      • Meter

        Meter - 2008-02-19

        MegaThanx :-)

         
        • cfreeer

          cfreeer - 2008-02-21

          The author is back.:)

           

Log in to post a comment.