Dismiss
InnovationQ will be updated on Sunday, Oct. 22, from 10am ET - noon. You may experience brief service interruptions during that time.
Browse Prior Art Database

Context-Sensitive Deletion of Characters in a C, C++ or Java Editor

IP.com Disclosure Number: IPCOM000119122D
Original Publication Date: 1997-Dec-01
Included in the Prior Art Database: 2005-Apr-01
Document File: 4 page(s) / 58K

Publishing Venue

IBM

Related People

Farn, B: AUTHOR

Abstract

Modification of C, C++, or Java code may require the shortening of existing code statements. Traditionally, a person using a character-based editor deletes a set of characters by specifying which characters are to be eliminated, then deletes them, or deletes each character in the set individually. Some editors provide a function which will erase characters until a space character is reached. However, this method can eliminate more characters than desired. A context-sensitive method of eliminating a character or a set of characters is discussed.

This text was extracted from an ASCII text file.
This is the abbreviated version, containing approximately 54% of the total text.

Context-Sensitive Deletion of Characters in a C, C++ or Java Editor

      Modification of C, C++, or Java code may require the shortening
of existing code statements.  Traditionally, a person using a
character-based editor deletes a set of characters by specifying
which characters are to be eliminated, then deletes them, or deletes
each character in the set individually.  Some editors provide a
function which will erase characters until a space character is
reached. However,  this method can eliminate more characters than
desired.  A context-sensitive method of eliminating a character or a
set of characters is discussed.

      An editor programmed to perform the following method will
delete characters, based on the context of the code at the cursor
position.
  1.  If the character at the cursor position is a space and
       there are one or more spaces immediately after the cursor
       position,
      a.  Delete all consecutive spaces following the cursor.
      b.  If the character before the cursor position is a space,
           delete the space at the cursor position.
            "This is a set     of spaces"   becomes
                           -
'            "This is a set of spaces"
                           -
            "This is a set     of spaces"   becomes
                           -
            "This is a set of spaces"
                           -
  2.  If the character at the cursor position is a space and the
       character immediately following the cursor is not a space,
      a.  Delete any subsequent consecutive alphanumeric, comma,
           or underscore characters.
      b.  Delete any consecutive spaces that are immediately after
           the alphanumeric, comma, or underscore characters.
      c.  If no characters were deleted, delete the character at
           the cursor position.
            "String s = new String()"       becomes
                           -
            "String s = new ()
                           -
            "String( ab, c_d, ef );         becomes
                           -
            "String( ab, ef );
                      -
            "if( x  != y )"                ...