locked
Is it possible to disable the "newline character" in Expression Web Code Edit? RRS feed

  • Question

  • I have tried to find an answer to this, but I am not even sure what the correct terminology is, so I am hoping someone here can give me guidance.

    At the end of each line of text in Code Edit view, there is an additional blank character, as if there is an extra space at the end of each line of code. When this extra character is selected, it will affect the next line. IE, if I select two lines of code, this extra character is always selected as well. If I delete the selected two lines, this causes the newline to also be deleted, causing the text following my deletion to end up on the same line as the previous text, or directly under it.

    Granted, this is a minor nuisance rather than a major problem, but I've never had this character show up in other editors, and would prefer to get rid of it if possible. Is there any setting that controls this? As I mentioned, I am not even sure what the proper term for the character is, so if I were looking at the option I probably wouldn't realize it.

    (Not sure if it matters, but this character is present in Vista and 7, and I have had it through both service packs.)

    • Edited by IntAvg Friday, April 23, 2010 4:14 PM Better title
    Friday, April 23, 2010 4:13 PM

All replies

  • Hmm.  I don't have an extra blank character at the end of the lines in Code View.  We'll have to see if anyone else reports having it.  (I don't have Win 7, so I don't know if that makes a difference.) You can set CSS to have a space after some attributes, but not regular HTML. (See Page Editing Options, Code Formatting).
    Friday, April 23, 2010 4:39 PM
  • Nor me as far as I can see. (On Win 7, but I doubt that's relevant).

    Not quite sure I understand the question either. If I delete two lines of code I'd expect the lines below to move up to fill the space created.

    Ian
    MS MVP Expression

    http://www.ew-resource.co.uk
    http://www.fp-resource.co.uk


    Ian Haynes
    Friday, April 23, 2010 4:45 PM
  • That's just a blank space, and EW is wrapping the code at that point at whatever length you set the line to (default is 80 characters), just like Word would at the right margin.

    You can change the length of the lines in the Page Editor options, but there's no specific character making it wrap at that point.

    Friday, April 23, 2010 4:46 PM
  • Since the OP said the blank was at the end of each line, I did not assume that it was line wrapping, and I think that is unlikely, but the OP can chime in on that.
    Friday, April 23, 2010 4:51 PM
  • Weird. I read the exact same thing (...each line of text...) and assumed the opposite, Kathy: that if it happened at each line (not just the end of a long string of code), then it was just wrapping.

    But it was also unclear to me from the phrasing whether it was text (content) or code he was speaking about.

     

    Friday, April 23, 2010 5:06 PM
  • Thank you for your replies so far. I am not sure how I can best explain this. When I look at the code in code view, it looks like this:

    $query = "SELECT COUNT(*) FROM bad_email WHERE email = '" . $this->admin_contact_email . "'";
    $result = mysql_query($query, $this->_db);
    $count = mysql_result($result, 0);

    Except imagine that each line has a space at the end of it (which I added but the forum won't underline).

    Now, normally, in Word for example, I could select the entire second line of code I show above, and press delete, which would leave a blank line between the other two lines. In Expression Web Code View, however, selecting the entire second line also selects this end of line character and as a result, when I delete the second line, it also removes the newline and gives me two lines of code. To give another example, suppose I am trying to just remove the ); from the second line. I highlight those two characters, but I get forced to select the end of line character as well (the way selecting a certain portion of the end of a word now forces you to select the following space in Word) - now I delete the );, but the third line also gets pulled up and appended to the end of line 2.

    I have never seen this type of behavior in another editor, and it is annoying.

    Let me try a screenshot... in the shot, the three lines above are highlighted, and as you can see, there is an extra character at the end of each selected line: http://wigedev.com/screenshot.jpg

    Friday, April 23, 2010 5:12 PM
  • What is being highlighted at the end of the line is a representation of the newline character. It is not a extra space. This representation is quite common in Microsoft programming language products. It is useful because it allows you to select complete lines or just the line up to the last character but not including the last newline.

    You should be able to establish this to your satisfaction by putting the cursor at the end of the line. If you just use the arrow keys to move the cursor back and forth, the cursor will move from the end of one line to the beginning of the next line.

    You can suppress selection of the last one as follows:

    • Select the set of lines. Be sure to start the selection from top left.
    • Use Shift-LeftArrow once to reduce the selection by what appears to be one character. The end of the selection will end up just after the last character of the last line.
    • Copy or delete as desired.

     


    Will
    Baltimore, MD USA - www.fastie.com
    Friday, April 23, 2010 5:45 PM
  • Well, I just tried it in Dreamweaver and EW3--opening the same page from one of my sites in each. I highlighted the same two lines in each editor, deleted them, and the rest of the code behaved exactly the same in Dreamweaver and EW3. The lower code moved up 2 lines in each.

    I also did what you describe in Word: highlight the second line and delete it. The lower code pops up one line. It does not leave a blank line between.

    Even deleting the 2 end characters-- ); --no problem. I can highlight just them and delete just them. Granted, it's easy to accidentally highlight the trailing space, but I have no problem avoiding it.

    Friday, April 23, 2010 6:07 PM
  • I see it is representing the newline, describing it as an extra space was just the only way I could think of to describe it's appearance. I have in some cases used the Shift-Left Arrow to deselect it, when I remember, but Expression Web is the only Microsoft development environment I have used, and so this is the only time that I have encountered this representation. In most cases, I am forced to select the newline because I am selecting more than one line at a time, and the program does not make it optional - I can only override it with the aforementioned keyboard shortcut.

    Is there any way in the preferences to turn this off so Expression acts like all of the other code editors I use?

    Friday, April 23, 2010 6:13 PM
  • Seem you are running into a difference in working with Windows standard conventions that are not likely to change. What OS did you come from?

    You can click at the beginning of what you want to copy and shift click at the end of what you want to copy w/o getting any extra spaces in what youare wanting to copy.


    MS MVP Expression Tutorials & Help http://by-expression.com
    Friday, April 23, 2010 6:31 PM
  • Now that it is clear that what you are talking about is the newline indication when lines are highlighted, I can comment.

    I am not forced to, and have no trouble avoiding, selecting the newline when selecting (as in your example) the final couple characters ); of a line.

    Am I correct in understanding that you want to select a group of lines and end up with a blank line when you delete them, that is, leaving a newline behind?

    I can do that by selecting with the mouse, and not selecting the final newline, although it takes care.  I confess, I rarely want to do that, but when I do want an extra blank line to replace several deleted lines, hitting return after the deletion does the trick just as fast.

     

     

    Friday, April 23, 2010 6:36 PM
  • There is nothing to turn off. It is not a configurable option.

    If what you are trying to do is select some number of lines and only those lines, for example to delete them or to replace them with some other lines, the usual method is to select with the mouse in the left margin where the line numbers appear. That selection mechanism selects only whole lines. If you select three lines that way and delete them, the previous line and the immediately following line should not collapse together.

    All of the other code editors I use work pretty much the same way.

    In most cases, I am forced to select the newline because I am selecting more than one line at a time, and the program does not make it optional -

    If you are selecting more than one line, by definition you are selecting the end of line characters. I'm having a difficult time understanding why making that optional would help.


    Will
    Baltimore, MD USA - www.fastie.com
    Friday, April 23, 2010 6:39 PM