Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6993071
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:43:02+00:00 2026-05-27T19:43:02+00:00

I have implemented basic syntax highlighting by properly setting the NSTextStorage delegate of my

  • 0

I have implemented basic syntax highlighting by properly setting the NSTextStorage delegate of my NSTextView and changing the text attributes in -textStorageDidProcessEditing.

The basic process is as follows

- (void)textStorageDidProcessEditing:(NSNotification *)notification {
  NSTextStorage *storage = [notification object];
  [storage beginEditing];

  NSString *text = [storage string];
  NSRange textRange = NSMakeRange(0, [text length]);

  [storage removeAttribute:NSForegroundColorAttributeName range:textRange];

  // Some regex matching here ...

  [storage addAttribute:NSForegroundColorAttributeName
                  value:[COSyntax colorForPatternGroup:pattern.groupName]
                  range:capturedRanges[group]];

  [storage endEditing];
}

Whenever -removeAttribute:range: or -addAttribute:value:range is invoked when a SPACE character is entered, the NSTextViews surrounding NSScrollView location begins to jump around (scroll knob goes to some random position near the )

What’s causing this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T19:43:03+00:00Added an answer on May 27, 2026 at 7:43 pm

    I have finally found out from my observations that the jumping happens not only when pressing spacebar but for other keys such as backspace as well and this happens exactly when both of these happen.
    – Non-contiguous layout is turned on
    – Any modification, even to attributes, of text preceding the visible region is made inside -textStorageDidProcessEditing:
    Looks like it is a bug in Non-contiguous layout feature! Would be good if an expert could confirm.
    It appears to have nothing to do with calling -beginEditing and -endEditing.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have implemented a very basic plug-in system as part of a static library
I have implemented a basic Karplus-Strong algorithm. Ringbuffer, filling with white noise, output a
I have my solution implemented (basic solution) and I'm happy. Problem is when I
In my project I have implemented basic class CVector. This class contains float* pointer
Following this example in the Java(tm) tutorials, I have implemented this basic one producer
The Join I have implemented is a basic one, but I can't figure out
I have implemented a basic file upload/download on top of AppEngine datastore. The functionality
Deal all, I have implemented some functions and like to ask some basic thing
I have implemented a basic page layout algorithm for footnote placement. Basically: Layout a
I have implemented a basic threaded producer-consumer (thread 1 = producer, thread 2 =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.