Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ConsoleWindow auto scroll after add msg #6

Open
danggui1995 opened this issue Jun 9, 2020 · 2 comments
Open

ConsoleWindow auto scroll after add msg #6

danggui1995 opened this issue Jun 9, 2020 · 2 comments

Comments

@danggui1995
Copy link

Hi, I found deleteCharactersInRange will cause auto scroll in Mac even I unchecked the scroll button, any good idea to fix it?

@u0u0
Copy link
Owner

u0u0 commented Jun 9, 2020

可能是个问题,由于LuaGameRunner没有处理Mac的菜单栏,目前是有一些问题存在。

@danggui1995
Copy link
Author

if ([linesCount count] >= MAX_LINES_COUNT)
{
    NSRange rg = textView.accessibilityVisibleCharacterRange;
    NSUInteger location = rg.location;
    NSUInteger length = rg.length;
    
    len = [linesCount objectAtIndex:0];
    NSUInteger lenuint = [len unsignedIntegerValue];
    [storage deleteCharactersInRange:NSMakeRange(0, lenuint)];
    
    [linesCount removeObjectAtIndex:0];
    [storage endEditing];
    
    if (location > 0 && location >= lenuint)
    {
        location -= lenuint;
    }
    else
    {
        location = 0;
        length = 0;
    }
    [self.textView scrollRangeToVisible: NSMakeRange(location, length)];
    [self.textView setNeedsDisplay:true];
}

我这样改了一下 感觉还行

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants