Merge pull request #2012 from matrix-org/t3chguy/autocomplete_mid_word
prevent user,room,group autocomplete firing mid-wordpull/21833/head
						commit
						fc816369da
					
				| 
						 | 
				
			
			@ -1,5 +1,6 @@
 | 
			
		|||
/*
 | 
			
		||||
Copyright 2018 New Vector Ltd
 | 
			
		||||
Copyright 2018 Michael Telatynski <7t3chguy@gmail.com>
 | 
			
		||||
 | 
			
		||||
Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
you may not use this file except in compliance with the License.
 | 
			
		||||
| 
						 | 
				
			
			@ -26,7 +27,7 @@ import {makeGroupPermalink} from "../matrix-to";
 | 
			
		|||
import type {Completion, SelectionRange} from "./Autocompleter";
 | 
			
		||||
import FlairStore from "../stores/FlairStore";
 | 
			
		||||
 | 
			
		||||
const COMMUNITY_REGEX = /(?=\+)(\S*)/g;
 | 
			
		||||
const COMMUNITY_REGEX = /\B\+\S*/g;
 | 
			
		||||
 | 
			
		||||
function score(query, space) {
 | 
			
		||||
    const index = space.indexOf(query);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,6 +2,7 @@
 | 
			
		|||
Copyright 2016 Aviral Dasgupta
 | 
			
		||||
Copyright 2017 Vector Creations Ltd
 | 
			
		||||
Copyright 2017, 2018 New Vector Ltd
 | 
			
		||||
Copyright 2018 Michael Telatynski <7t3chguy@gmail.com>
 | 
			
		||||
 | 
			
		||||
Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
you may not use this file except in compliance with the License.
 | 
			
		||||
| 
						 | 
				
			
			@ -28,7 +29,7 @@ import _sortBy from 'lodash/sortBy';
 | 
			
		|||
import {makeRoomPermalink} from "../matrix-to";
 | 
			
		||||
import type {Completion, SelectionRange} from "./Autocompleter";
 | 
			
		||||
 | 
			
		||||
const ROOM_REGEX = /(?=#)(\S*)/g;
 | 
			
		||||
const ROOM_REGEX = /\B#\S*/g;
 | 
			
		||||
 | 
			
		||||
function score(query, space) {
 | 
			
		||||
    const index = space.indexOf(query);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,6 +3,7 @@
 | 
			
		|||
Copyright 2016 Aviral Dasgupta
 | 
			
		||||
Copyright 2017 Vector Creations Ltd
 | 
			
		||||
Copyright 2017, 2018 New Vector Ltd
 | 
			
		||||
Copyright 2018 Michael Telatynski <7t3chguy@gmail.com>
 | 
			
		||||
 | 
			
		||||
Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
you may not use this file except in compliance with the License.
 | 
			
		||||
| 
						 | 
				
			
			@ -30,7 +31,7 @@ import type {Room, RoomMember} from 'matrix-js-sdk';
 | 
			
		|||
import {makeUserPermalink} from "../matrix-to";
 | 
			
		||||
import type {SelectionRange} from "./Autocompleter";
 | 
			
		||||
 | 
			
		||||
const USER_REGEX = /@\S*/g;
 | 
			
		||||
const USER_REGEX = /\B@\S*/g;
 | 
			
		||||
 | 
			
		||||
export default class UserProvider extends AutocompleteProvider {
 | 
			
		||||
    users: Array<RoomMember> = null;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue